> What is the behavior of using alarm() in one of the threads
> in a multi-threaded program? Which will thread will get the
> note?

Threads don't get notes.  Processes do.  The function you
register with threadnotify will run in the same proc that
got the note, and if that proc was in a system call, that
system call will have been interrupted, regardless of which
thread inside the proc was running the system call.

If your code looks like:

    alarm(10);
    read();
    alarm(0);

then you can be sure that your thread's read is the one that
will be interrupted should the alarm go off.

> Also, where can I find sample code to handle terminal
> abort/interrupt?

Depends on what you mean by this.  If you mean when
the user types Delete to kill a program, that turns into
a "interrupt" note.

Russ

Reply via email to