[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: concurrent access



Leonardo Lanzi writes:
 > Thank you, it's a good help.
 > Anyhow, I cannot use signals because I've problems with our  (threaded)
 > programs.
 > I' m still studying itifg* ....

Actually, you can use signals in threaded programs - use
pthread_sigmask to block the signals you are interested in in all of
your threads, then use sigwait to block a thread until the signal
arrives.

But that leads me on to another question (for the list):

Lets say I have two framegrabber cards (PCDig in this case) in the
machine, but only one (multithreaded) process handling the images from 
both cards. How do I know, when I get a SIGIO, which card generated
it? Do I have to poll() the file descriptors for both cards?

On a similar subject, can anyone explain the interaction between
signals, threads and fcntl(F_SETOWN)? According to the POSIX
specification, a signal is delivered to an arbitrary thread within the 
process. You can force the signal to be delivered to a specific thread 
by blocking the signal in all threads, and sigwaiting for it in your
signal handling thread.

However, on Linux, each thread has its own PID, so does doing a
fcntl(F_SETOWN) guarantee the signal is delivered to that thread?

Any help on this would be greatly appreciated.

Will

-- 
Will Lockhart, System Developer, Axiom (Cambridge) Ltd.
http://www.mvhi.com/