Hi Kiran
----- Kiran wrote: ----
Was wondering if its possible to have a event notification in Thread whe
the thread is about to start and the thread has just finished doing its wor
and about to terminate
Yes, but not automatically. I see two ways to achieve this.
(1) Pass two callbacks to your thread, one for signaling the thread has started, the other to signal that the thread has finished. In your thread, call the callbacks at the appropriate moment (start & end). Beware of synchronization issues. The callbacks are wrapped using delegates
(2) Provide two events for your thread, one that signals thread startup, the other signals thread completion. Signal these events at the appropriate moment from your thread. Have another thread monitor these events. The possible event classes that I am talking about are ManualResetEvent and AutoResetEvent (and Mutex, but not useful in this context). These classes derive from WaitHandle, and provide wait functionality
If its not directly available, I was thinking to derive a class form Threa
and provide this events, but again its a sealed class. Is there a way to d
this
The Thread class is sealed, so aggregation/composition is your instrument. I think it is common to write a base thread class for your projects which does all plumbing
I do not want to waste time pooling or waiting for the other thread t
finish I can rather so someting useful
Then I suggest you use callbacks. These could post a message, which you could process when you have the time. This is easily done using a queue.
Regard
Kira
HTH
Tom Tempelaere.