C
cj_junktrap
Hi
Is there something like an intra-thread lock? I'm trying to prevent
re-entrant code, and the lock statement will only prevent one thread
from entering the critical section while another thread is in it -
since my code is triggered by a gui event, it's not impossible that it
could be called twice from the same thread. I could simulate a lock by
having a private variable "busy" and setting that to true when I start
processing, false when I stop, and check it before I begin processing -
but then either I have to throw an exception if I'm already busy
processing (which I'd prefer not to do), or I'd have to use a polling
wait loop to simulate a blocking call - which seems ugly.
Any ideas of a better way to do this?
Thanks
Is there something like an intra-thread lock? I'm trying to prevent
re-entrant code, and the lock statement will only prevent one thread
from entering the critical section while another thread is in it -
since my code is triggered by a gui event, it's not impossible that it
could be called twice from the same thread. I could simulate a lock by
having a private variable "busy" and setting that to true when I start
processing, false when I stop, and check it before I begin processing -
but then either I have to throw an exception if I'm already busy
processing (which I'd prefer not to do), or I'd have to use a polling
wait loop to simulate a blocking call - which seems ugly.
Any ideas of a better way to do this?
Thanks