Messages in this thread | | | Date | Wed, 14 Jul 1999 21:48:56 +0200 | From | Jamie Lokier <> | Subject | Re: AMIGA will use Linux, but Linux has several "multimedia-deficiencies" |
| |
Gerard Roudier wrote: > Using select() and une unique message queue for read is possible with > conjunction of SIGIO/SIGALRM with the risk of the application to lose time > if it has very bad luck. > > You can implement something like that: > > If you expect event(s) from fds (basically SIGIO will kick ass you) > > 1) set an alarm of a few seconds (<=2 seconds for example) > also set the alarm from the alarm handler. > > 2) get next message in blocking mode > > 3) if interrupted go with poll/select the fds > (can be either SIGIO or SIGALRM) > > If you are so unfortunate that the SIGIO occurs between 1 and 2, your > program will only be stuck for less than 1..2 seconds. > (The period between (1) and (2) that may let msgrcv block can be minimized > by some additionnal code).
You can get rid of the possible 1..2 second delay by using sigsetjmp before 2 and siglongjmp in the SIGIO handler.
It crashes some systems (cygwinb19.1) but is completely reliable on others (Linux).
> By the way, this works for me since 10 years in some applications, and I > never have been able to get the problem in my testings. Indeed it is not > clean and not optimal at all, but when you haven't the choice such a > band-aid is really helpfull.
Yes your solution is the one I use too. You can catch SIGCHLD and other signals this way too -- everything becomes an event, innit great :-)
-- Jamie
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |