I've been puzzling over something that I thought
someone on this list
might have a good solution for. I need to make a low
priority
(non-real time) thread wait for a real time thread to
do something. I
can't use a semaphore or condition variable for this,
because that
would mean the low priority thread must briefly take a
lock while
examining the condition variable or sempahore. If it
were to be
pre-empted while holding this lock, the RT thread
could block waiting
to obtain the lock in order to signal the condition or
modify the
semaphore.
I could prevent this by raising the priority of the
low priority
thread before taking the lock, but I don't know how to
do this in
a portable way (i.e., I want my app to port to windows
and mac, but
even on "posix compliant" systems, getting RT
privileges seems to
be pretty system-dependent).
It occurs to me that I could just "busy wait" using a
timer, which
would work but is a bit inelegant. Has anyone else
come up with a good
solution for this problem?
Thanks for any thoughts -- Ken McMillan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com