[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hurd_condition_wait in glibc libpthreads in Debian




>No, the semantics are the same. The internal implementation may slightly
>differ, I haven't looked in detail. The point is how to handle
>cancellation from a cancelled thread, not how to mark a thread as being
>cancelled. The hurd_thread_cancel function merely exists because there
>isn't any in the cthreads package. You should be able to replace it with
>pthread_cancel without further effort.

>-- 
>Richard Braun

I don't think that the semantics are the same. From what I can tell,
hurd_thread_cancel kindly informs the thread that it has been canceled
and should take an appropriate action, while pthread_cancel has the
thread call pthread_exit at the next cancellation point. How they mark a
thread as canceled differs too: hurd cancellation is flagged within the
thread's struct hurd_sigstate, while pthread cancellation is flagged
within the thread's struct __pthread.

Here is the declaration of hurd_thread_cancel from glibc's hurd.h:
/* Cancel pending operations on THREAD.  If it is doing an interruptible RPC,
   that RPC will now return EINTR; otherwise, the "cancelled" flag will be
   set, causing the next `hurd_check_cancel' call to return nonzero or the
   next interruptible RPC to return EINTR (whichever is called first).  */
extern error_t hurd_thread_cancel (thread_t thread);

Thomas D



Reply to: