Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:29
oscarderooij6-May-08 2:29 
GeneralRe: Running a form in a diferent Thread Pin
S. Senthil Kumar6-May-08 2:54
S. Senthil Kumar6-May-08 2:54 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:27
oscarderooij13-May-08 3:27 
AnswerRe: Running a form in a diferent Thread Pin
Luc Pattyn5-May-08 7:19
sitebuilderLuc Pattyn5-May-08 7:19 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:42
oscarderooij6-May-08 2:42 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn6-May-08 4:21
sitebuilderLuc Pattyn6-May-08 4:21 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:25
oscarderooij13-May-08 3:25 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:45
sitebuilderLuc Pattyn13-May-08 3:45 
Hi Oscar,

No, I don't recall any exsceptional article on the subject, but that doesn't mean there are
none, it just says that's the kind of things I stopped reading long ago.

interthread communication isn't that hard. Basically the threads all can access your data,
so the one problem to avoid is having thread1 read some data while thread2 is modifying
that data, resulting in thread1 possibly having an inconsistent view of the data (parts
already changed, parts not yet updated).

The way to avoid this is typically is by locking the data whenever a consistent state is
needed and/or an "atomic update" has to be performed.

In C# the lock keyword is the key.

BTW: if you forget to apply locks, your program will typically run fine for a while,
then occasionally it will produce unexpected results.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

I dislike the black-and-white voting system on questions/answers. Dead | X|


GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:28
oscarderooij13-May-08 3:28 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:40
sitebuilderLuc Pattyn13-May-08 3:40 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij15-May-08 7:45
oscarderooij15-May-08 7:45 
QuestionForeach property in myClass Pin
Harvey Saayman5-May-08 3:57
Harvey Saayman5-May-08 3:57 
AnswerRe: Foreach property in myClass Pin
Colin Angus Mackay5-May-08 4:04
Colin Angus Mackay5-May-08 4:04 
AnswerRe: Foreach property in myClass Pin
S. Senthil Kumar5-May-08 4:06
S. Senthil Kumar5-May-08 4:06 
GeneralRe: Foreach property in myClass Pin
Harvey Saayman5-May-08 4:12
Harvey Saayman5-May-08 4:12 
GeneralRe: Foreach property in myClass Pin
carbon_golem5-May-08 5:01
carbon_golem5-May-08 5:01 
GeneralRe: Foreach property in myClass Pin
Nouman Bhatti5-May-08 4:07
Nouman Bhatti5-May-08 4:07 
AnswerRe: Foreach property in myClass Pin
Yevgen Lisovenko5-May-08 4:07
Yevgen Lisovenko5-May-08 4:07 
AnswerRe: Foreach property in myClass Pin
Ennis Ray Lynch, Jr.5-May-08 10:30
Ennis Ray Lynch, Jr.5-May-08 10:30 
QuestionCrystal Reports Pin
GermanDM5-May-08 3:51
GermanDM5-May-08 3:51 
QuestionPass DataGridView to a UserControl Pin
mariusth5-May-08 3:51
mariusth5-May-08 3:51 
QuestionThreading question Pin
kensai5-May-08 3:48
kensai5-May-08 3:48 
AnswerRe: Threading question Pin
carbon_golem5-May-08 4:05
carbon_golem5-May-08 4:05 
AnswerRe: Threading question Pin
S. Senthil Kumar5-May-08 4:11
S. Senthil Kumar5-May-08 4:11 
GeneralRe: Threading question Pin
kensai5-May-08 21:28
kensai5-May-08 21:28 

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.