Hello,
I'm having trouble pausing LThreads (used to download data from a
network). I first implemented this using a semaphore in the thread's
run method. The problem is that each thread has to finish it's current
task before the semaphore kicks in so with a lot of threads it takes
several seconds for everything to actually pause.
Next I tried using Suspend() (called for all active threads from the
main thread), which it seems is what I wanted in the first place.
However, it doesn't do anything. The Suspend() function changes mState
to threadState_Suspended, but then the thread gets swapped in anyway
(from LThread::Yield()), with LThread::SwapContext changing the state
back to threadState_Current. The thread then continues downloading data
as usual.
How can I suspend an LThread such that it will not be swapped in, or
given any cpu time, until I resume it?
Kurt