Click here to Skip to main content
15,922,630 members
Home / Discussions / C#
   

C#

 
GeneralRe: can't understand suspendedLayout Pin
Luc Pattyn8-Jan-08 1:53
sitebuilderLuc Pattyn8-Jan-08 1:53 
GeneralRe: can't understand suspendedLayout Pin
Ed.Poore7-Jan-08 8:54
Ed.Poore7-Jan-08 8:54 
QuestionThreadin.Thread Problem Pin
humayunlalzad7-Jan-08 5:37
humayunlalzad7-Jan-08 5:37 
GeneralRe: Threadin.Thread Problem Pin
Judah Gabriel Himango7-Jan-08 6:04
sponsorJudah Gabriel Himango7-Jan-08 6:04 
GeneralRe: Threadin.Thread Problem Pin
humayunlalzad7-Jan-08 6:42
humayunlalzad7-Jan-08 6:42 
GeneralRe: Threadin.Thread Problem Pin
Judah Gabriel Himango7-Jan-08 7:04
sponsorJudah Gabriel Himango7-Jan-08 7:04 
GeneralRe: Threadin.Thread Problem Pin
humayunlalzad7-Jan-08 8:30
humayunlalzad7-Jan-08 8:30 
GeneralRe: Threadin.Thread Problem Pin
Judah Gabriel Himango7-Jan-08 10:30
sponsorJudah Gabriel Himango7-Jan-08 10:30 
humayunlalzad wrote:
When you say "will make the threads join in the StartIt" which threads are you referring to.

The main UI thread and the thdTest thread.
humayunlalzad wrote:
What I gathered is that StartIt() is being run by the Main thread and DoIt() is being run by the background thread(Thread 2) and when I use thdTest.Join() the Main Thread stops executing and waits for Thread 2 to finish its job (including writing on lblInfo2) and when Thread 2 is done, then the Main thread picks up from there again and finishes its job.

That's correct. It will block the UI thread (e.g. freeze the UI) until DoIt() is done executing.

humayunlalzad wrote:
Why isn't the label dispalaying the first line of StartIt()

Because the other thread may or may not have set it yet; threads don't execute in any particular order. So if the label was being set in one thread, and looked at in another thread, it's possible that by the time one thread looks at the value, it's not yet set for the other thread.

This is all complex stuff. It gets only more complex once you start having to think about locks to protect variables and data shared between threads.

Here's how you make it simple: don't share memory between threads. That means don't share variables or other data between threads. If another thread needs some data from one thread, make a copy of the data and send him the copy.


Tech, life, family, faith: Give me a visit.
I'm currently blogging about: What this world needs... (Video)
The apostle Paul, modernly speaking: Epistles of Paul

Judah Himango


GeneralRe: Threadin.Thread Problem Pin
Patrick Etc.7-Jan-08 7:41
Patrick Etc.7-Jan-08 7:41 
GeneralRe: Threadin.Thread Problem Pin
Judah Gabriel Himango7-Jan-08 7:50
sponsorJudah Gabriel Himango7-Jan-08 7:50 
GeneralRe: Threadin.Thread Problem Pin
humayunlalzad7-Jan-08 8:32
humayunlalzad7-Jan-08 8:32 
GeneralRe: Threadin.Thread Problem Pin
Luc Pattyn7-Jan-08 8:50
sitebuilderLuc Pattyn7-Jan-08 8:50 
GeneralRe: Threadin.Thread Problem Pin
Judah Gabriel Himango7-Jan-08 9:53
sponsorJudah Gabriel Himango7-Jan-08 9:53 
GeneralRe: Threadin.Thread Problem Pin
humayunlalzad8-Jan-08 20:56
humayunlalzad8-Jan-08 20:56 
GeneralWeb services in runtime Pin
Goncalo Oliveira7-Jan-08 5:31
Goncalo Oliveira7-Jan-08 5:31 
GeneralRe: Web services in runtime Pin
Pete O'Hanlon7-Jan-08 10:27
mvePete O'Hanlon7-Jan-08 10:27 
Generalreading bytes into directory Pin
gottimukkala7-Jan-08 5:24
gottimukkala7-Jan-08 5:24 
GeneralRe: reading bytes into directory Pin
Judah Gabriel Himango7-Jan-08 7:52
sponsorJudah Gabriel Himango7-Jan-08 7:52 
GeneralRe: reading bytes into directory Pin
Christian Graus7-Jan-08 9:34
protectorChristian Graus7-Jan-08 9:34 
QuestionCan you tell what menu item the mouse is pointing at? [modified] Pin
earlgraham7-Jan-08 5:15
earlgraham7-Jan-08 5:15 
AnswerRe: Can you tell what menu item the mouse is pointing at? Pin
Judah Gabriel Himango7-Jan-08 6:24
sponsorJudah Gabriel Himango7-Jan-08 6:24 
GeneralRe: Can you tell what menu item the mouse is pointing at? Pin
earlgraham7-Jan-08 10:07
earlgraham7-Jan-08 10:07 
GeneralRe: Can you tell what menu item the mouse is pointing at? Pin
Judah Gabriel Himango7-Jan-08 10:22
sponsorJudah Gabriel Himango7-Jan-08 10:22 
AnswerRe: Can you tell what menu item the mouse is pointing at? Pin
PIEBALDconsult7-Jan-08 8:13
mvePIEBALDconsult7-Jan-08 8:13 
GeneralRe: Can you tell what menu item the mouse is pointing at? Pin
earlgraham7-Jan-08 10:10
earlgraham7-Jan-08 10:10 

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.