By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,060 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,060 IT Pros & Developers. It's quick & easy.

join() timesout even though thread has completed

P: n/a
Hi,
I'd just like to know why, when a System.Threading.Timer timer is fired, and
I set a class variable to CurrentThread within the Timer method, that when
calling Join on that thread in a different thread, it times out even though
the Timer method has completed.
Do I need to explicitly create a new thread explicitly in the Timer method
being fired and join on that new thread instead? I would have imagined that
when the Timer goes off, a thread is created in the background and joining
on that thread would have worked.
Thanks.
Craig
Nov 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Craig,

I believe the timer class fires an event on a thread from the thread
pool, which is why you won't see the thread die (it is being kept alive in
the pool).

If you are looking for a signal for when a task is complete, you should
not use the join method on the thread. Rather, you should set up an event
and wait on that.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Craig" <mc******@mtn.co.za> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi,
I'd just like to know why, when a System.Threading.Timer timer is fired,
and I set a class variable to CurrentThread within the Timer method, that
when calling Join on that thread in a different thread, it times out even
though the Timer method has completed.
Do I need to explicitly create a new thread explicitly in the Timer method
being fired and join on that new thread instead? I would have imagined
that when the Timer goes off, a thread is created in the background and
joining on that thread would have worked.
Thanks.
Craig

Nov 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.