[openbeos] odd code in expander

  • From: Alan Westbrook <alan@xxxxxxxxxxxxxx>
  • To: OpenBeOS <openbeos@xxxxxxxxxxxxx>
  • Date: Mon, 19 Apr 2004 02:30:06 -0700

hi all!


There is some odd code in the expander having to do with threads, perhaps someone can explain some parts to me:


There are a number of functions that all almost look exactluy like this:

status_t
ExpanderThread::InterruptExternalExpander()
{
    status_t status = B_OK;
    thread_info thread_info;
    status = get_thread_info (fThreadId, &thread_info);
    BString    thread_name = thread_info.name;

    if (status == B_OK) {
        status = send_signal(-fThreadId, SIGINT);
        WaitOnExternalExpander();
    }
    return status;
}

The problems I have with this are thus:

1) using get_thread_info to see if the thread is ok is susceptable to race conditions.

2) What is the purpose of gettign the thread name?

3) Why is the signal being sent to the negative of the thread id?

Thanks!

Alan

Other related posts: