Alphadan
May 30th, 2011, 11:14 PM
Im implementing the re entrance on my application i start threads to process some data then when the job finishes the thread gets on hold for 15 seconds if there is another job avaliable it will asign it to that thread Resuming it, But if there are no more jobs and the 15 seconds pass the thread exits.
sometimes i try to resume threads but they wont start i improved my error handler and i been monitoring the suspend count i noticed these threads that wont start are returning 0 instead of 1 like they should.
the documentation says the thread was not suspended, but doesnt say anything else im not sure if the thread was really ruuning or even if it was terminated by exiting its entrypoint function...
so my question is would Resume Thread return 0 if the thread is not suspended but ended? or would it return -1?
how would i track that bug i have no idea yet, the thread should be suspended everytime it finishes its job for 15 seconds if there is not another job in the next 15 seconds the thread exits normally.
any recomendation is welcome thx in advance!
Edit: Is this way to add pauses using resume thread and and suspend thread a good practice?
sometimes i try to resume threads but they wont start i improved my error handler and i been monitoring the suspend count i noticed these threads that wont start are returning 0 instead of 1 like they should.
the documentation says the thread was not suspended, but doesnt say anything else im not sure if the thread was really ruuning or even if it was terminated by exiting its entrypoint function...
so my question is would Resume Thread return 0 if the thread is not suspended but ended? or would it return -1?
how would i track that bug i have no idea yet, the thread should be suspended everytime it finishes its job for 15 seconds if there is not another job in the next 15 seconds the thread exits normally.
any recomendation is welcome thx in advance!
Edit: Is this way to add pauses using resume thread and and suspend thread a good practice?