Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
QuestionOptimization kills program. Pin
harold aptroot17-Apr-09 8:18
harold aptroot17-Apr-09 8:18 
AnswerRe: Optimization kills program. Pin
Colin Angus Mackay17-Apr-09 8:47
Colin Angus Mackay17-Apr-09 8:47 
GeneralRe: Optimization kills program. Pin
harold aptroot17-Apr-09 8:56
harold aptroot17-Apr-09 8:56 
AnswerRe: incorrect code kills program? Pin
Luc Pattyn17-Apr-09 9:07
sitebuilderLuc Pattyn17-Apr-09 9:07 
GeneralRe: incorrect code kills program? Pin
harold aptroot17-Apr-09 9:18
harold aptroot17-Apr-09 9:18 
GeneralRe: incorrect code kills program? Pin
Luc Pattyn17-Apr-09 9:36
sitebuilderLuc Pattyn17-Apr-09 9:36 
GeneralRe: incorrect code kills program? Pin
harold aptroot17-Apr-09 9:58
harold aptroot17-Apr-09 9:58 
GeneralRe: incorrect code kills program? Pin
Luc Pattyn17-Apr-09 10:11
sitebuilderLuc Pattyn17-Apr-09 10:11 
That is right if executed once; and it may be right if inside a loop.

If both sides contain a loop and need to synchronize each iteration of it, then I consider it bad style to create new ResetEvents (or whatever synchronization object) all the time, since one party could be manipulating the old/new object whereas the other is manipulating the new/old object (which they probably share through a shared variable, say a class member) probably leading to a stand-still.

I would suggest you add some logging: let your threads report somehow what they are doing. I always have a protected void log(string s) method present in all my classes, it's implementation could be as simple as Console.WriteLine(s); or could be somewhat more complex, possibly with the current time, the current thread's ID, optional file output, etc.

Seeing the system-wide actions in chronological order helps in debugging, much more than breakpoints and other fancy stuff if you ask me. The Visual goodies are more suited for solving very local problems, once you now about where they are.

Smile | :)

Luc Pattyn [Forum Guidelines] [My Articles]

Avoiding unwanted divs (as in "articles needing approval") with the help of this FireFox add-in


GeneralRe: incorrect code kills program? Pin
harold aptroot17-Apr-09 10:15
harold aptroot17-Apr-09 10:15 
AnswerRe: Optimization kills program. Pin
S. Senthil Kumar18-Apr-09 9:46
S. Senthil Kumar18-Apr-09 9:46 
GeneralRe: Optimization kills program. Pin
harold aptroot18-Apr-09 11:02
harold aptroot18-Apr-09 11:02 
GeneralRe: Optimization kills program. Pin
S. Senthil Kumar18-Apr-09 21:27
S. Senthil Kumar18-Apr-09 21:27 
GeneralRe: Optimization kills program. Pin
harold aptroot19-Apr-09 0:55
harold aptroot19-Apr-09 0:55 
GeneralRe: Optimization kills program. Pin
S. Senthil Kumar19-Apr-09 1:11
S. Senthil Kumar19-Apr-09 1:11 
GeneralRe: Optimization kills program. Pin
harold aptroot19-Apr-09 1:13
harold aptroot19-Apr-09 1:13 
GeneralRe: Optimization kills program. Pin
S. Senthil Kumar19-Apr-09 1:19
S. Senthil Kumar19-Apr-09 1:19 
GeneralRe: Optimization kills program. Pin
harold aptroot19-Apr-09 1:30
harold aptroot19-Apr-09 1:30 
GeneralRe: Optimization kills program. Pin
S. Senthil Kumar19-Apr-09 1:49
S. Senthil Kumar19-Apr-09 1:49 
GeneralRe: Optimization kills program. Pin
harold aptroot19-Apr-09 1:51
harold aptroot19-Apr-09 1:51 
Questioncopy row from one datagridview to another Pin
behzadcp17-Apr-09 7:54
professionalbehzadcp17-Apr-09 7:54 
QuestionPDF button recognition in C# Windows App. [modified] Pin
Engineer Joe17-Apr-09 7:30
Engineer Joe17-Apr-09 7:30 
AnswerRe: PDF button recognition in C# Windows App. Pin
buachaill cliste17-Apr-09 9:07
buachaill cliste17-Apr-09 9:07 
GeneralRe: PDF button recognition in C# Windows App. Pin
Engineer Joe20-Apr-09 9:46
Engineer Joe20-Apr-09 9:46 
GeneralRe: PDF button recognition in C# Windows App. Pin
buachaill cliste20-Apr-09 10:33
buachaill cliste20-Apr-09 10:33 
QuestionFailing to read ExecutablePath Pin
IFDTCACT17-Apr-09 7:15
IFDTCACT17-Apr-09 7:15 

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.