Re: [PATCH] Add missing wrapper function to pthread_cancel

Wilfried Goesgens <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
On Wed, Apr 13, 2005 at 09:10:27PM +0200, Wilfried Goesgens wrote:
> pthread offers a function to forcibly end a thread. 
> 
> usefull if a thread is caught in blocking I/O which makes
> it freeze.
> 
> 
> the C code:
> 
...
>  #endif
--- /home/willi/src/sms/old/gateway-kannelcvstree/gwlib/gwthread-pthread.c      2005-04-13 18:13:38.000000000 +0200
+++ gwthread-pthread.c  2005-04-13 21:19:34.000000000 +0200
@@ -730,7 +730,7 @@ int gwthread_poll(struct pollfd *fds, lo
 }
 
 
-void gwthread_sleep(double seconds)
+int gwthread_sleep(double seconds)
 {
     struct pollfd pollfd;
     struct threadinfo *threadinfo;
@@ -755,6 +755,7 @@ void gwthread_sleep(double seconds)
     if (ret == 1) {
         flushpipe(pollfd.fd);
     }
+       return ret;
 }
 
 
@@ -801,4 +802,14 @@ static int pthread_sigmask()
 {
     return 0;
 }
+
+
 #endif
+
+int gwthread_cancel(long thread)
+{
+       struct threadinfo *th=THREAD(thread);
+
+       return pthread_cancel(th->self);
+}
+

this way it gets compiled if DARWIN_OLD is not defined :(

Sincerely, 
  Wilfried Goesgens
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.