diff options
Diffstat (limited to 'doc/gpgme.texi')
| -rw-r--r-- | doc/gpgme.texi | 19 | 
1 files changed, 12 insertions, 7 deletions
| diff --git a/doc/gpgme.texi b/doc/gpgme.texi index c2bb3092..72b9e22c 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -5318,6 +5318,9 @@ structure because the number of file descriptors needed for a crypto  operation in @acronym{GPGME} is not predictable.  @example +#include <assert.h> +#include <errno.h> +#include <stdlib.h>  #include <pthread.h>  #include <sys/types.h>  #include <gpgme.h> @@ -5337,6 +5340,7 @@ struct one_fd    int dir;    gpgme_io_cb_t fnc;    void *fnc_data; +  void *loop;  @};  struct event_loop @@ -5368,6 +5372,7 @@ add_io_cb (void *data, int fd, int dir, gpgme_io_cb_t fnc, void *fnc_data,  	  fds[i].dir = dir;  	  fds[i].fnc = fnc;  	  fds[i].fnc_data = fnc_data; +	  fds[i].loop = loop;  	  break;  	@}      @} @@ -5382,6 +5387,7 @@ void  remove_io_cb (void *tag)  @{    struct one_fd *fd = tag; +  struct event_loop *loop = fd->loop;    pthread_mutex_lock (&loop->lock);    fd->fd = -1; @@ -5413,11 +5419,12 @@ do_select (struct event_loop *loop)    fd_set wfds;    int i, n;    int any = 0; +  struct one_fd *fdlist = loop->fds;    pthread_mutex_lock (&loop->lock);    FD_ZERO (&rfds);    FD_ZERO (&wfds); -  for (i = 0; i < FDLIST_MAX; i++) +  for (i = 0; i < MAX_FDS; i++)      if (fdlist[i].fd != -1)        FD_SET (fdlist[i].fd, fdlist[i].dir ? &rfds : &wfds);    pthread_mutex_unlock (&loop->unlock); @@ -5432,7 +5439,7 @@ do_select (struct event_loop *loop)      return n;	/* Error or timeout.  */    pthread_mutex_lock (&loop->lock); -  for (i = 0; i < FDLIST_MAX && n; i++) +  for (i = 0; i < MAX_FDS && n; i++)      @{        if (fdlist[i].fd != -1)  	@{ @@ -5463,7 +5470,6 @@ wait_for_op (struct event_loop *loop, struct op_result *result)        ret = do_select (loop);      @}    while (ret >= 0 && !result->done); -  return ret;  @}  @end example @@ -5478,7 +5484,6 @@ main (int argc, char *argv[])    gpgme_ctx_t ctx;    gpgme_error_t err;    gpgme_data_t sig, text; -  gpgme_sig_stat_t status;    int i;    struct gpgme_io_cb_ts io_cbs =    @{ @@ -5492,7 +5497,7 @@ main (int argc, char *argv[])    init_gpgme (void);    /* Initialize the loop structure.  */ -  loop.lock = PTHREAD_MUTEX_INITIALIZER; +  pthread_mutex_init (&loop.lock, NULL);    for (i = 0; i < MAX_FDS; i++)      loop->fds[i].fd = -1; @@ -5507,7 +5512,7 @@ main (int argc, char *argv[])    if (!err)      @{         gpgme_set_io_cbs (ctx, &io_cbs); -       err = gpgme_op_verify_start (ctx, sig, text, &status); +       err = gpgme_op_verify_start (ctx, sig, text, NULL);      @}    if (err)      @{ @@ -5528,7 +5533,7 @@ main (int argc, char *argv[])                 gpgme_strsource (result.err), gpgme_strerror (result.err));        exit (1);      @} -  /* Evaluate STATUS.  */ +  /* Evaluate verify result.  */    @dots{}    return 0;  @} | 
