summaryrefslogtreecommitdiffstats
path: root/libkdenetwork/libgpgme-copy/gpgme/wait-private.c
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2011-11-16 16:06:07 -0600
committerTimothy Pearson <[email protected]>2011-11-16 16:06:07 -0600
commitbe0ca741fd12897337408d1d7a7d8f5f18e1fac9 (patch)
treeb9fa3458193a17180d8773a0204ee05ae206cd99 /libkdenetwork/libgpgme-copy/gpgme/wait-private.c
parentbbb7afdb6da2969535e7f05715e2cb95cfdc917c (diff)
downloadtdepim-be0ca741fd12897337408d1d7a7d8f5f18e1fac9.tar.gz
tdepim-be0ca741fd12897337408d1d7a7d8f5f18e1fac9.zip
Finish rename from prior commit
Diffstat (limited to 'libkdenetwork/libgpgme-copy/gpgme/wait-private.c')
-rw-r--r--libkdenetwork/libgpgme-copy/gpgme/wait-private.c147
1 files changed, 0 insertions, 147 deletions
diff --git a/libkdenetwork/libgpgme-copy/gpgme/wait-private.c b/libkdenetwork/libgpgme-copy/gpgme/wait-private.c
deleted file mode 100644
index 3f2b819d2..000000000
--- a/libkdenetwork/libgpgme-copy/gpgme/wait-private.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* wait-private.c
- Copyright (C) 2000 Werner Koch (dd9jn)
- Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH
-
- This file is part of GPGME.
-
- GPGME is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of
- the License, or (at your option) any later version.
-
- GPGME is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
-
-#if HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <assert.h>
-#include <errno.h>
-
-#include "gpgme.h"
-#include "context.h"
-#include "wait.h"
-#include "ops.h"
-#include "priv-io.h"
-#include "util.h"
-
-
-/* The private event loops are used for all blocking operations, and
- for the key and trust item listing operations. They are completely
- separated from each other. */
-
-
-/* Internal I/O callback functions. */
-
-/* The add_io_cb and remove_io_cb handlers are shared with the global
- event loops. */
-
-void
-_gpgme_wait_private_event_cb (void *data, gpgme_event_io_t type,
- void *type_data)
-{
- switch (type)
- {
- case GPGME_EVENT_START:
- /* Nothing to do here, as the wait routine is called after the
- initialization is finished. */
- break;
-
- case GPGME_EVENT_DONE:
- break;
-
- case GPGME_EVENT_NEXT_KEY:
- _gpgme_op_keylist_event_cb (data, type, type_data);
- break;
-
- case GPGME_EVENT_NEXT_TRUSTITEM:
- _gpgme_op_trustlist_event_cb (data, type, type_data);
- break;
- }
-}
-
-
-/* If COND is a null pointer, wait until the blocking operation in CTX
- finished and return its error value. Otherwise, wait until COND is
- satisfied or the operation finished. */
-gpgme_error_t
-_gpgme_wait_on_condition (gpgme_ctx_t ctx, volatile int *cond)
-{
- gpgme_error_t err = 0;
- int hang = 1;
-
- do
- {
- int nr = _gpgme_io_select (ctx->fdt.fds, ctx->fdt.size, 0);
- unsigned int i;
-
- if (nr < 0)
- {
- /* An error occured. Close all fds in this context, and
- signal it. */
- unsigned int idx;
-
- err = gpg_error_from_errno (errno);
- for (idx = 0; idx < ctx->fdt.size; idx++)
- if (ctx->fdt.fds[idx].fd != -1)
- _gpgme_io_close (ctx->fdt.fds[idx].fd);
- _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err);
-
- return err;
- }
-
- for (i = 0; i < ctx->fdt.size && nr; i++)
- {
- if (ctx->fdt.fds[i].fd != -1 && ctx->fdt.fds[i].signaled)
- {
- ctx->fdt.fds[i].signaled = 0;
- assert (nr);
- nr--;
-
- err = _gpgme_run_io_cb (&ctx->fdt.fds[i], 0);
- if (err)
- {
- /* An error occured. Close all fds in this context,
- and signal it. */
- unsigned int idx;
-
- for (idx = 0; idx < ctx->fdt.size; idx++)
- if (ctx->fdt.fds[idx].fd != -1)
- _gpgme_io_close (ctx->fdt.fds[idx].fd);
- _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err);
- return err;
- }
- }
- }
-
- for (i = 0; i < ctx->fdt.size; i++)
- if (ctx->fdt.fds[i].fd != -1)
- break;
- if (i == ctx->fdt.size)
- {
- _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err);
- hang = 0;
- }
- if (cond && *cond)
- hang = 0;
- }
- while (hang);
-
- return 0;
-}
-
-
-/* Wait until the blocking operation in context CTX has finished and
- return the error value. */
-gpgme_error_t
-_gpgme_wait_one (gpgme_ctx_t ctx)
-{
- return _gpgme_wait_on_condition (ctx, NULL);
-}