Click to See Complete Forum and Search --> : Callback Function Problem


twj100
April 4th, 2002, 09:59 PM
I'm using WINSNMP API to develop a SNMP-based tool. I have encounter some problem with the CALLBACK funtion. As far as i concern, each CALLBACK funtion will create a new thread, but some of the threads create by the callback will not end. It appears to me as a blocking situation. I would like to ask how can force the callback functions(threads) to end?

NMTop40
April 5th, 2002, 01:45 AM
There are two types of threads, worker threads and user-interface threads.

Worker threads perform a task then end.

User interface threads have message pumps and remain active until they get a WM_QUIT message, just like applications.

But only worker threads use a callback function. However this callback function could contain synchronisation functions (WaitForSingleObject, WaitForMultipleObjectsEx) and could contain a loop, so they do not actually terminate until such-and-such event has happened.

I don't know exactly what the situation is with your model.

The best things come to those who rate

twj100
April 5th, 2002, 07:01 PM
for my situation...its up to the implementation(Winsnmp API) to close the thread...there is something i want to verify...is the callback function a thread function itself?or its just a function that is called by a worker thread in background?