G
Guest
(Having been told of a solution to one problem
(File::CREAT was indeed what was needed), I'll now go
off on something entirely different.)
I've been trying to figure out how thread safety
works, and mostly failing. I can sort of understand
how the examples work, but I don't quite see how to
take it and implement something useful.
Basically, I'm going to have some objects. Only one
thread should access an object at a time, and each
thread will only access one object at a time. I'd like
to be able to put something in the object that a
thread can call on, which will allow the thread to
continue when the object is available, and then the
thread can release the object so other threads can use
it.
This doesn't seem quite appropriate to use a mutex,
and ConditionVariable, which sounds like it's doing
something similar, is always used within a mutex.
Also, a thread shouldn't wait until a something else
sends a signal - unless some other thread has
specifically asked for the object, it should execute
immediately.
The Semaphore library on RAA sounds like it might do
something like this, but I haven't been able to figure
out quite how it works, so I'm not certain if it does
what I want.
Can anyone explain to me how to do something like
this?
-Morgan
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/
(File::CREAT was indeed what was needed), I'll now go
off on something entirely different.)
I've been trying to figure out how thread safety
works, and mostly failing. I can sort of understand
how the examples work, but I don't quite see how to
take it and implement something useful.
Basically, I'm going to have some objects. Only one
thread should access an object at a time, and each
thread will only access one object at a time. I'd like
to be able to put something in the object that a
thread can call on, which will allow the thread to
continue when the object is available, and then the
thread can release the object so other threads can use
it.
This doesn't seem quite appropriate to use a mutex,
and ConditionVariable, which sounds like it's doing
something similar, is always used within a mutex.
Also, a thread shouldn't wait until a something else
sends a signal - unless some other thread has
specifically asked for the object, it should execute
immediately.
The Semaphore library on RAA sounds like it might do
something like this, but I haven't been able to figure
out quite how it works, so I'm not certain if it does
what I want.
Can anyone explain to me how to do something like
this?
-Morgan
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/