Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Oct 98 16:30:13 -0600
From:      "Richard Seaman, Jr." <lists@tar.com>
To:        "John Birrell" <jb@cimlogic.com.au>
Cc:        "current@freebsd.org" <current@FreeBSD.ORG>
Subject:   Re: Kernel threading (was Re: Thread Scheduler bug)
Message-ID:  <199810312230.QAA24045@ns.tar.com>

next in thread | raw e-mail | index | archive | help
On Sun, 1 Nov 1998 08:47:34 +1100 (EST), John Birrell wrote:

>If you wrapper the syscalls, you get compatibility problems. If the
>syscalls block in the kernel, then that's where thay should be cancelled.

Well, I don't know nearly as much about this as you do, so please bear
with me.  The syscall wrapper I am talking about looks like this
(for the syscalls that are defined as canellation points):

  pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
  _thread_sys_xxx (..........)                               
  pthread_setcanceltype (oldtype, NULL);                        

Then, if another thread does a pthread_cancel on the thread that's
in the syscall, and if the cancel state of the thread is CANCEL_ENABLE,
it sends it a signal SIGCANCEL.  SIGCANCEL will have to be defined
(Linux uses SIGUSR2, if I'm not mistaken).  You have to have a signal
handler setup too, obviously, which does a pthread_exit (in the case
of ASYNCHRONOUS cancellation).  If the syscall can be interrupted by
the signal, you'll break out of the wait and exit.  If not, you'll exit
when the second pthread_setcanceltype function is called.  

What am I missing?

>Is that the user LDT implementation?

I don't know.  Its whatever code was posted in John Dyson's message of
August 20, 1998, to the -hackers list, titled "rfork stuff".  I have
a copy if you need one.  I'm just copying some of his code blindly,
with only partial (or no) comprehension.  If there's something fundamentally
wrong with it, it would be helpful if you noted it so I don't waste
my time.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199810312230.QAA24045>