Timers and threads

This is the root of the problem with using SDL audio with the timer:

There’s a basic problem with timers and threads.

The UNIX timer mechanism is based on the SIGALRM signal.
The UNIX threads do not have a standard way that signals
and threads interact.
They do, but they don’t all do it properly. :slight_smile:

Actually, there is a standard, POSIX, but it’s vague and
not usually well implemented in the case of thread and
signal interaction.
Its getting there, compared to a couple of years ago the implementations
under Linux have improved massively (and the commercial UNIX’s should hopefully
implement it properly)

Anybody with more information, feel free to jump in. :slight_smile:
I beleive (someone correct me if I’m wrong), that if a parent thread
gets a signal, the same signal will be sent to all children. But not the
reverse.

Hopefully it is implemented properly in the lib’s… as I just looked and
found this comment in the Linux kernel.
(signal.c : dequeue_signal() )
/* XXX: Once CLONE_PID is in to join those “threads” that are
part of the same “process”, look for signals sent to the
"process" as well. */

and another comment in there (different function)
/* POSIX.1b doesn’t mention process groups. */

Hopefully libpthread traps all the signals, and resends them to the children
automatically. I don’t have the source to libpthread on my HDD at the moment,
nor do I have a copy of the POSIX standard.

I’ll put more detailed information out when I figure it all out. :slight_smile:

good luck :slight_smile:

cya
Josh-----
“COBOL – Compiles Only Because Of Luck”

This is the root of the problem with using SDL audio with the timer:

There’s a basic problem with timers and threads.

The UNIX timer mechanism is based on the SIGALRM signal.
The UNIX threads do not have a standard way that signals
and threads interact.

Actually, there is a standard, POSIX, but it’s vague and
not usually well implemented in the case of thread and
signal interaction.

Anybody with more information, feel free to jump in. :slight_smile:

I’ll put more detailed information out when I figure it all out. :slight_smile:

See ya!
-Sam Lantinga (slouken at devolution.com)–
Author of Simple DirectMedia Layer -
http://www.devolution.com/~slouken/SDL/