Click here to Skip to main content
16,005,222 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem to Create Database in SqlServer from Client. Pin
Paul Conrad3-Dec-06 16:11
professionalPaul Conrad3-Dec-06 16:11 
QuestionThreading/Delegate Freezes my App [modified] Pin
dubbaluga3-Dec-06 12:16
dubbaluga3-Dec-06 12:16 
AnswerRe: Threading/Delegate Freezes my App Pin
Judah Gabriel Himango3-Dec-06 12:18
sponsorJudah Gabriel Himango3-Dec-06 12:18 
GeneralRe: Threading/Delegate Freezes my App Pin
dubbaluga3-Dec-06 12:24
dubbaluga3-Dec-06 12:24 
GeneralRe: Threading/Delegate Freezes my App Pin
Judah Gabriel Himango3-Dec-06 12:30
sponsorJudah Gabriel Himango3-Dec-06 12:30 
GeneralRe: Threading/Delegate Freezes my App Pin
dubbaluga3-Dec-06 12:31
dubbaluga3-Dec-06 12:31 
GeneralRe: Threading/Delegate Freezes my App Pin
Judah Gabriel Himango3-Dec-06 12:31
sponsorJudah Gabriel Himango3-Dec-06 12:31 
AnswerRe: Threading/Delegate Freezes my App Pin
S. Senthil Kumar4-Dec-06 4:16
S. Senthil Kumar4-Dec-06 4:16 
You're running into the classic deadlock problem. The Form1_FormClosing event is triggered on the UI thread through the message pump. You block execution of the event, waiting for comReadThread.Join. Imagine if at that point of time, comReadThreadProc reads a line and calls SetText. SetText then quite rightly calls Control.Invoke to marshal the call to the UI thread. But now the UI thread is hung waiting for comReadThread to complete and comReadThread will complete only if Invoke completes, which will only happen if the UI thread is free (i.e not waiting for Join). Clearly, that will not happen and you'll therefore deadlock.

The solution is to either remove the Join or use Control.BeginInvoke instead of Invoke. With BeginInvoke however, it's possible that the delegate will run after the form has closed, so you would have to take care of that condition.

Regards
Senthil [MVP - Visual C#]
_____________________________
My Blog | My Articles | My Flickr | WinMacro

Questionlock touchpad Pin
DarsVaeda3-Dec-06 11:51
DarsVaeda3-Dec-06 11:51 
AnswerRe: lock touchpad Pin
logoto_it3-Dec-06 16:37
logoto_it3-Dec-06 16:37 
AnswerRe: lock touchpad Pin
Christian Graus3-Dec-06 17:59
protectorChristian Graus3-Dec-06 17:59 
GeneralRe: lock touchpad Pin
Dan Neely4-Dec-06 2:12
Dan Neely4-Dec-06 2:12 
GeneralRe: lock touchpad Pin
DarsVaeda4-Dec-06 12:04
DarsVaeda4-Dec-06 12:04 
QuestionChanging the datatype of strings Pin
minnie mouse3-Dec-06 11:37
minnie mouse3-Dec-06 11:37 
AnswerRe: Changing the datatype of strings Pin
Christian Graus3-Dec-06 11:52
protectorChristian Graus3-Dec-06 11:52 
GeneralRe: Changing the datatype of strings Pin
minnie mouse3-Dec-06 12:06
minnie mouse3-Dec-06 12:06 
GeneralRe: Changing the datatype of strings Pin
kourvoisier3-Dec-06 12:25
kourvoisier3-Dec-06 12:25 
GeneralRe: Changing the datatype of strings Pin
minnie mouse4-Dec-06 21:18
minnie mouse4-Dec-06 21:18 
GeneralRe: Changing the datatype of strings Pin
Christian Graus3-Dec-06 12:35
protectorChristian Graus3-Dec-06 12:35 
GeneralRe: Changing the datatype of strings Pin
minnie mouse4-Dec-06 11:33
minnie mouse4-Dec-06 11:33 
GeneralRe: Changing the datatype of strings Pin
Christian Graus4-Dec-06 11:39
protectorChristian Graus4-Dec-06 11:39 
GeneralRe: Changing the datatype of strings Pin
minnie mouse4-Dec-06 21:13
minnie mouse4-Dec-06 21:13 
AnswerRe: Changing the datatype of strings Pin
KeesVer4-Dec-06 1:11
KeesVer4-Dec-06 1:11 
QuestionMenu Events Pin
Mark F.3-Dec-06 9:48
Mark F.3-Dec-06 9:48 
AnswerRe: Menu Events Pin
mav.northwind3-Dec-06 10:09
mav.northwind3-Dec-06 10:09 

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.