Click here to Skip to main content
15,901,505 members
Home / Discussions / C#
   

C#

 
GeneralRe: Awesome short cuts with VS2005 Pin
Christopher Stratmann15-Oct-07 0:49
Christopher Stratmann15-Oct-07 0:49 
QuestionRegarding to Browsers Button Pin
Rinki Mukheraji15-Oct-07 0:31
Rinki Mukheraji15-Oct-07 0:31 
AnswerRe: Regarding to Browsers Button Pin
Andrei Ungureanu15-Oct-07 1:43
Andrei Ungureanu15-Oct-07 1:43 
AnswerRe: Regarding to Browsers Button Pin
Pete O'Hanlon15-Oct-07 3:13
mvePete O'Hanlon15-Oct-07 3:13 
AnswerRe: Regarding to Browsers Button Pin
Pete O'Hanlon15-Oct-07 3:15
mvePete O'Hanlon15-Oct-07 3:15 
GeneralRe: Regarding to Browsers Button Pin
Malcolm Smart15-Oct-07 3:34
Malcolm Smart15-Oct-07 3:34 
GeneralRe: Regarding to Browsers Button Pin
Pete O'Hanlon15-Oct-07 3:40
mvePete O'Hanlon15-Oct-07 3:40 
QuestionHow to create windows custom control in c#.net Pin
NK715-Oct-07 0:11
NK715-Oct-07 0:11 
AnswerRe: How to create windows custom control in c#.net Pin
Andrei Ungureanu15-Oct-07 0:16
Andrei Ungureanu15-Oct-07 0:16 
QuestionPanel Opacity Pin
AB777114-Oct-07 23:49
AB777114-Oct-07 23:49 
AnswerRe: Panel Opacity Pin
Ajay.k_Singh15-Oct-07 0:25
Ajay.k_Singh15-Oct-07 0:25 
AnswerRe: Panel Opacity Pin
Martin#15-Oct-07 1:49
Martin#15-Oct-07 1:49 
QuestionGet Thread Result (IAsyncResult) Pin
Patricio Tapia14-Oct-07 23:05
Patricio Tapia14-Oct-07 23:05 
AnswerRe: Get Thread Result (IAsyncResult) Pin
Mandaar Kulkarni14-Oct-07 23:24
Mandaar Kulkarni14-Oct-07 23:24 
AnswerRe: Get Thread Result (IAsyncResult) Pin
lmoelleb14-Oct-07 23:31
lmoelleb14-Oct-07 23:31 
A thread terminates when it has no more code to execute (it gets to the end of the method you set as it's start method).

You REALLY need to understand how threads interact or you will just spend your entire time debugging things you do not know anything about. Read some tutorials, for example this one:
MSDN[^]

Generally speaking you communicate with one of the following methods:
1) Communicate with Events (ManualResetEvent, AutoResetEvent). This is typically used to signal things like "data inserted in queue", "terminate" etc. The advantage is that a thread can wait for an event to be raised without consuming CPU resources.
2) Shared data protected by locks. For example a queue one thread is inserting in while another thread reads, or the tread setting a value on a "result object" passed to it. Simple datatypes (int, bool etc) can be marked by the keyword "volatile" instead of using a lock for each access.
3) Invoking from your subtread to the main thread (look at the Dispatcher object, or the old WinForm.Invoke stuff). This allows updating for example a WinForm userinterface where only the GUI thread is allowed to change control values, but is also a pretty sollid way to ensure data is only manipulated on one thread which means you do not need to do locks (as long as you make sure the worker thread is always working on a copy of the data).

Instead of setting a terminate event you can allso raise a ThreadInterupt exception, but please notice a thread will NOT interrupt while executing your code - it will ONLY interrupt from a safe state, like waiting for an event... and in that case you can as well have it wait for a terminate event as well. Smile | :)
GeneralRe: Get Thread Result (IAsyncResult) Pin
Patricio Tapia15-Oct-07 0:19
Patricio Tapia15-Oct-07 0:19 
Questionabout html operate [modified] Pin
jason_mf14-Oct-07 22:58
jason_mf14-Oct-07 22:58 
AnswerRe: about html operate Pin
Mandaar Kulkarni14-Oct-07 23:09
Mandaar Kulkarni14-Oct-07 23:09 
GeneralRe: about html operate Pin
jason_mf14-Oct-07 23:13
jason_mf14-Oct-07 23:13 
GeneralRe: about html operate Pin
Mandaar Kulkarni14-Oct-07 23:22
Mandaar Kulkarni14-Oct-07 23:22 
GeneralRe: about html operate Pin
jason_mf15-Oct-07 5:02
jason_mf15-Oct-07 5:02 
GeneralRe: about html operate Pin
Mandaar Kulkarni15-Oct-07 20:04
Mandaar Kulkarni15-Oct-07 20:04 
AnswerRe: about html operate Pin
Guffa14-Oct-07 23:14
Guffa14-Oct-07 23:14 
GeneralRe: about html operate Pin
jason_mf14-Oct-07 23:28
jason_mf14-Oct-07 23:28 
GeneralRe: about html operate Pin
Guffa15-Oct-07 6:56
Guffa15-Oct-07 6:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.