Click here to Skip to main content
15,891,704 members
Home / Discussions / C#
   

C#

 
QuestionUI hangs on Invoke(?) Pin
jondaeh17-Mar-09 9:37
jondaeh17-Mar-09 9:37 
AnswerRe: UI hangs on Invoke(?) Pin
fred_17-Mar-09 10:06
fred_17-Mar-09 10:06 
AnswerRe: UI hangs on Invoke(?) Pin
fred_17-Mar-09 10:06
fred_17-Mar-09 10:06 
GeneralRe: UI hangs on Invoke(?) Pin
jondaeh17-Mar-09 10:51
jondaeh17-Mar-09 10:51 
GeneralRe: UI hangs on Invoke(?) Pin
Natza Mitzi17-Mar-09 10:16
Natza Mitzi17-Mar-09 10:16 
QuestionRe: UI hangs on Invoke(?) Pin
jondaeh17-Mar-09 11:09
jondaeh17-Mar-09 11:09 
AnswerRe: UI hangs on Invoke(?) Pin
Luc Pattyn17-Mar-09 14:52
sitebuilderLuc Pattyn17-Mar-09 14:52 
GeneralRe: UI hangs on Invoke(?) Pin
jondaeh17-Mar-09 22:55
jondaeh17-Mar-09 22:55 
Hi!

Followed your advice, and it worked great right away! Smile | :)

However, it's still some details that is not completely clear to me. I know that it doesn't matter now that it is working, but I can't stand not knowing what went wrong(psycho.. OMG | :OMG: ).

1.
I know that the loop I had written would never stop. However, what do you mean with stack overflow? As I see it, it will just go around and around, with a pause on 100ms on every cycle. Or does it make a new "process" on each cycle?

3.
I tried to have that lock I had written there on both places where line was accessed. This I meant as a safety to prevent line not to be written from the scanThread and read by writeThread at the same time.
I see why these locks didn't work, but how do I get a lock to understand what object it shall lock? Would I have to write it like this: lock(line){"do something with line"} ? Or must line be accessed from inside a method to make a lock?

4.
I used DiscardBuffer() to make sure that scanThread would get hold on only the newest byte. I was afraid of the buffer to fill up with several bytes while the writeThread did it's job. But I see now how accessing serialPort from another thread will make unnecessary thread "collision". Now I just implemented DiscardBuffer() before the while loop, and it seem to work fine.


Sorry being so curious, but I think these threading things is very interesting. Plus, apparently, we won't be learning it at school Frown | :(

Thanks for good help and good feedback! Appreciate it!

Jon.
GeneralRe: UI hangs on Invoke(?) Pin
Luc Pattyn18-Mar-09 1:24
sitebuilderLuc Pattyn18-Mar-09 1:24 
QuestionLotus Notes Pin
lokesh143.surana17-Mar-09 9:02
lokesh143.surana17-Mar-09 9:02 
AnswerRe: Lotus Notes Pin
Dan Neely17-Mar-09 9:44
Dan Neely17-Mar-09 9:44 
GeneralRe: Lotus Notes Pin
dan!sh 17-Mar-09 10:36
professional dan!sh 17-Mar-09 10:36 
GeneralRe: Lotus Notes Pin
Dan Neely17-Mar-09 11:07
Dan Neely17-Mar-09 11:07 
GeneralRe: Lotus Notes Pin
dan!sh 17-Mar-09 19:45
professional dan!sh 17-Mar-09 19:45 
GeneralRe: Lotus Notes Pin
Vikram A Punathambekar17-Mar-09 20:40
Vikram A Punathambekar17-Mar-09 20:40 
QuestionNewbie Question Pin
kruegersck17-Mar-09 7:57
kruegersck17-Mar-09 7:57 
AnswerRe: Newbie Question Pin
DaveyM6917-Mar-09 8:29
professionalDaveyM6917-Mar-09 8:29 
AnswerRe: Newbie Question Pin
Natza Mitzi17-Mar-09 10:25
Natza Mitzi17-Mar-09 10:25 
Questionaccessing members without reflection. Pin
Member 232448317-Mar-09 7:50
Member 232448317-Mar-09 7:50 
AnswerRe: accessing members without reflection. Pin
0x3c017-Mar-09 8:03
0x3c017-Mar-09 8:03 
GeneralRe: accessing members without reflection. Pin
Member 232448317-Mar-09 8:19
Member 232448317-Mar-09 8:19 
AnswerRe: accessing members without reflection. [modified] Pin
Mbah Dhaim17-Mar-09 9:15
Mbah Dhaim17-Mar-09 9:15 
GeneralRe: accessing members without reflection. Pin
Member 232448317-Mar-09 9:44
Member 232448317-Mar-09 9:44 
GeneralRe: accessing members without reflection. Pin
Natza Mitzi17-Mar-09 10:31
Natza Mitzi17-Mar-09 10:31 
QuestionC# DLL Events Catching. Pin
Navneet Hegde17-Mar-09 6:00
Navneet Hegde17-Mar-09 6:00 

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.