Hi,
Was wondering if its possible to have a event notification in Thread when
the thread is about to start and the thread has just finished doing its work
and about to terminate.
If its not directly available, I was thinking to derive a class form Thread
and provide this events, but again its a sealed class. Is there a way to do
this?
I do not want to waste time pooling or waiting for the other thread to
finish I can rather so someting useful.
Any help is most welcome.
Regards
Kiran 3 3909
Hi Kiran,
Just declare the events in your main code, then when the thread starts it
can trigger the event asynchronously using BeginInovke method of your event.
Same when the thread finishes the job.
hope this helps
Fitim Skenderi
"Kiran" <ki****@abc.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl... Hi,
Was wondering if its possible to have a event notification in Thread
when the thread is about to start and the thread has just finished doing its
work and about to terminate. If its not directly available, I was thinking to derive a class form
Thread and provide this events, but again its a sealed class. Is there a way to
do this? I do not want to waste time pooling or waiting for the other thread to finish I can rather so someting useful.
Any help is most welcome.
Regards Kiran
Hi,
Will this kind of helped, Now I created my own class that wraps this
Thread class & the Execute method.
Thanks Again
Kiran
"Fitim Skenderi" <fi****@hotmail.com> wrote in message
news:ex**************@TK2MSFTNGP12.phx.gbl... Hi Kiran,
Just declare the events in your main code, then when the thread starts it can trigger the event asynchronously using BeginInovke method of your
event. Same when the thread finishes the job.
hope this helps
Fitim Skenderi
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. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: cnu |
last post by:
Hi,
I am starting a new threading to do some process. I want to get notified
when the thread does it's job and exits. After receiving the notification, I
want to refresh the form.
I am...
|
by: Will |
last post by:
I have a Manager thread that launches a variable number of Worker threads.
When each Worker thread finishes, I want it to notify the Manager thread
that it's done so that the Manager thread can...
|
by: Kiran |
last post by:
Hi,
Was wondering if its possible to have a event notification in Thread when
the thread is about to start and the thread has just finished doing its work
and about to terminate.
If its not...
|
by: Ivan |
last post by:
Hi
I have following problem: I'm creating two threads who are performing some
tasks. When one thread finished I would like to restart her again (e.g. new
job). Following example demonstrates...
|
by: droopytoon |
last post by:
Hi,
I start a new thread (previous one was "thread timing") because I have
isolated my problem.
It has nothing to do with calling unmanaged C++ code (I removed it in a
test application).
I...
|
by: Daniel |
last post by:
i have an array that i want all threads to be able to READ from
concurrently, however, at times i want to UPDATE the array. at which point i
want all threads that use it to block when they try to...
|
by: Anders Eriksson |
last post by:
Hello!
I have a form from which I start an thread running in the background and I
want to have an event when the thread is done/ends.
I start the thread like this:
private Thread prT; // this...
|
by: Chrace |
last post by:
Hi all,
I have a problem with with Thread.Join( Timeout ) where the timeout never occurs.
I basically need to make a connection to an AS400 box which works fine. Once in a blue moon the AS400...
|
by: Steve |
last post by:
Hi All,
I've been trying to come up with a good way to run a certain process
at a timed interval (say every 5 mins) using the SLEEP command and a
semaphore flag. The basic thread loop was always...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |