diff options
| author | Werner Koch <[email protected]> | 2019-06-13 06:40:33 +0000 |
|---|---|---|
| committer | Werner Koch <[email protected]> | 2019-06-13 06:40:33 +0000 |
| commit | 28e620fa169dcbfc2301ae9bea58ebe3ccc3504a (patch) | |
| tree | 28be2b60116d54a3ba83f8297332bf56e5561728 /src/priv-io.h | |
| parent | core: Use fully correct command args for gpg --verify. (diff) | |
| download | gpgme-28e620fa169dcbfc2301ae9bea58ebe3ccc3504a.tar.gz gpgme-28e620fa169dcbfc2301ae9bea58ebe3ccc3504a.zip | |
core: Refactor the wait code utilizing the new fdtable.
* src/fdtable.c, src/fdtable.h: Largely extend.
* src/wait-global.c, src/wait-private.c, src/wait-user.c: Remove and
move code to ...
* src/wait.c: here.
(_gpgme_fd_table_init, fd_table_put): Remove. Do not call them.
(_gpgme_add_io_cb, _gpgme_add_io_cb_user): Change to use the fdtable.
(_gpgme_remove_io_cb, _gpgme_remove_io_cb_user): Ditto.
(_gpgme_wait_global_event_cb): Ditto.
(gpgme_wait_ext, _gpgme_wait_on_condition): Ditto.
* src/wait.h (struct io_cb_tag_s): Add fields 'serial' and 'desc'.
Change 'idx' to 'fd'.
(struct fd_table): Remove.
* src/context.h (struct gpgme_context): Remoce 'fdt'. Rename io_cbs
to user_io_cbs for clarity.
* src/engine-gpgsm.c: Unify trace output.
(start): Pass a description along with the IO handlers.
* src/priv-io.h (struct io_select_fd_s): Rename to io_select_s.
(io_select_t): New.
* src/gpgme.c (_gpgme_cancel_with_err): Replace arg 'ctx' by 'serial'.
(gpgme_cancel): Adjust.
--
This is the second part of a larger refactoring of the wait/event
code. Does currently only work on Unix and with the private wait
functions (i.e. the async operations don't yet work).
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/priv-io.h')
| -rw-r--r-- | src/priv-io.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/priv-io.h b/src/priv-io.h index f40cdffc..27cc07eb 100644 --- a/src/priv-io.h +++ b/src/priv-io.h @@ -51,14 +51,15 @@ struct spawn_fd_item_s int arg_loc; }; -struct io_select_fd_s +struct io_select_s { int fd; - int for_read; - int for_write; - int signaled; - void *opaque; + unsigned int for_read:1; + unsigned int for_write:1; + unsigned int signaled:1; }; +typedef struct io_select_s *io_select_t; + /* These function are either defined in posix-io.c or w32-io.c. */ void _gpgme_io_subsystem_init (void); @@ -89,7 +90,7 @@ int _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags, void (*atfork) (void *opaque, int reserved), void *atforkvalue, pid_t *r_pid); -int _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock); +int _gpgme_io_select (io_select_t fds, unsigned int nfds, int nonblock); /* Write the printable version of FD to the buffer BUF of length BUFLEN. The printable version is the representation on the command |
