On Friday, January 23, 2004, at 09:39 , Dan Sugalski wrote:

At 12:05 PM +0100 1/23/04, Leopold Toetsch wrote:

So my local src/events.c does:

1) block all signals before any thread creation
2) install an event handler for SIGINT
3) start the event handler thread
4) start an IO handler thread, which does:
- unblock SIGINT
- select in a while loop
- if select returns -1, check for EINTR and the sig_atomic_t flag set by the signal handler

All this stuff needs to get out of events.c at some point, and we probably better do it now rather than later. Not because they're not events, but because this behaviour is all very platform-dependent, and so ought to go in the platform-local source instead. (It's not even Unix-dependent, as all the different unix flavors handle signals and threads differently)


What we need to do is get an abstraction in place for this and write platform-specific code to get concrete implementations of that abstraction in place. Which also means we need to have more complex processing of the platform source files.

It may even be important enough to probe this stuff at runtime and select the appropriate implementation then, so that a single parrot binary can be compatible across different versions of the same operating system. For instance: Linux flavors with per-thread PIDs, or different versions of Mac OS X with evolving pthreads implementations (or with and without poll()). Or Windows 98 vs. Server 2003. Finally, if the most performant strategy might differ for uniprocessors and multiprocessors.




Gordon Henriksen
[EMAIL PROTECTED]

Reply via email to