diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-11-23 06:29:56 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-11-23 06:29:56 +0800 |
commit | eaa2814a05c8c3a094a00400cc5651e408ee9e18 (patch) | |
tree | 4a53b01741ec0655bd6499123263716b74d98e0e /camel/camel-operation.c | |
parent | 554b987da7d9579b23a62c50f95b8305e1c5a72c (diff) | |
download | gsoc2013-evolution-eaa2814a05c8c3a094a00400cc5651e408ee9e18.tar.gz gsoc2013-evolution-eaa2814a05c8c3a094a00400cc5651e408ee9e18.tar.zst gsoc2013-evolution-eaa2814a05c8c3a094a00400cc5651e408ee9e18.zip |
Use the new camel_operation_cancel_prfd() function to get the cancellation
2002-11-21 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-ssl.c (stream_read): Use the new
camel_operation_cancel_prfd() function to get the cancellation fd
so we can poll on it for cancellation stuff.
(stream_write): Same.
2002-11-22 Not Zed <NotZed@Ximian.com>
* camel-operation.c (camel_operation_cancel_prfd): Implement, gets
a nspr pr filedesc to poll/wait on
(struct _CamelOperation): include a pr filedesc.
svn path=/trunk/; revision=18894
Diffstat (limited to 'camel/camel-operation.c')
-rw-r--r-- | camel/camel-operation.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/camel/camel-operation.c b/camel/camel-operation.c index 6c490df73f..8befacce19 100644 --- a/camel/camel-operation.c +++ b/camel/camel-operation.c @@ -5,6 +5,9 @@ #include <stdio.h> #ifdef ENABLE_THREADS #include <pthread.h> +#ifdef HAVE_NSS +#include <nspr.h> +#endif #endif #include <sys/time.h> @@ -42,6 +45,9 @@ struct _CamelOperation { #ifdef ENABLE_THREADS EMsgPort *cancel_port; int cancel_fd; +#ifdef HAVE_NSS + PRFileDesc *cancel_prfd; +#endif #endif }; @@ -436,6 +442,40 @@ int camel_operation_cancel_fd(CamelOperation *cc) return cc->cancel_fd; } +#ifdef HAVE_NSS +/** + * camel_operation_cancel_prfd: + * @cc: + * + * Retrieve a file descriptor that can be waited on (select, or poll) + * for read, to asynchronously detect cancellation. + * + * Return value: The fd, or NULL if cancellation is not available + * (blocked, or has not been registered for this thread). + **/ +PRFileDesc *camel_operation_cancel_prfd(CamelOperation *cc) +{ + CAMEL_ACTIVE_LOCK(); + + if (cc == NULL && operation_active) { + cc = g_hash_table_lookup(operation_active, (void *)pthread_self()); + } + + if (cc == NULL + || cc->blocked) { + CAMEL_ACTIVE_UNLOCK(); + return NULL; + } + + if (cc->cancel_prfd == NULL) + cc->cancel_prfd = e_msgport_prfd(cc->cancel_port); + + CAMEL_ACTIVE_UNLOCK(); + + return cc->cancel_prfd; +} +#endif /* HAVE_NSS */ + /** * camel_operation_start: * @cc: |