Click here to Skip to main content
15,909,332 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionWhy does .ThreadState.ToString Behave This Way? Pin
treddie4-Jul-13 20:37
treddie4-Jul-13 20:37 
AnswerRe: Why does .ThreadState.ToString Behave This Way? Pin
AlphaDeltaTheta4-Jul-13 21:19
AlphaDeltaTheta4-Jul-13 21:19 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
treddie4-Jul-13 21:37
treddie4-Jul-13 21:37 
AnswerRe: Why does .ThreadState.ToString Behave This Way? Pin
AlphaDeltaTheta4-Jul-13 21:49
AlphaDeltaTheta4-Jul-13 21:49 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
treddie4-Jul-13 23:22
treddie4-Jul-13 23:22 
JokeRe: Why does .ThreadState.ToString Behave This Way? Pin
Tim Carmichael5-Jul-13 2:42
Tim Carmichael5-Jul-13 2:42 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
Dave Kreskowiak5-Jul-13 3:57
mveDave Kreskowiak5-Jul-13 3:57 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
treddie5-Jul-13 11:38
treddie5-Jul-13 11:38 
Sorry for the frustration showing.

But in an attempt to understand what is going on, here is the way threads should behave the way I understand it. Let's say I have two threads that calculate the results of some equations:
Thread-1 produces  1........2....... 4.......8........16.......32<br />
Thread-2 produces  1.5....1.837....2.49....3.929....7.789....21.737


1. All threads are suspended at time (t). Since Thread-1 is iterating faster than Thread-2, due to simpler equations, Thread-1 makes more progress than Thread-2, by time (t).

2. Since the exact moments that Threads 1 & 2 will be suspended will most likely occur asynchronously, this may add further uncertainty as to when Threads 1 & 2 will actually come to a halt. This could result in another complete iteration "slipping through" in either thread. But most likely, each thread will be suspended somewhere in the middle of an iteration. Nonetheless, the output values will not change until an iteration is completed.

3. At time (t + DELTAt), queries are made of the results from Threads 1 & 2. Obviously, both queries cannot be made at the exact same moment. So let's say that Thread-1 was queried first, followed by the query of Thread-2. The results are:
Thread-1.....16<br />
Thread-2.....2.49


4. The queries are NON-suspended actions performed on suspended Threads 1 & 2. Therefore, the results should be the same regardless of when the queries were actually made. Thus, the queries are actions that do not affect the results, once the threads have settled down into their suspended states.

There will be many times when the above timing disparities will not be an issue...I may simply need to see the results at time (t) regardless of any synchronization issues. If I need better synchronization so that the outputs are synchronized at some value of an independent variable, then I can simply stop each thread independently on separate time-dependent bounds.

Beyond that, why, in your understanding, would the queries affect the results?
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
Ron Beyer5-Jul-13 12:20
professionalRon Beyer5-Jul-13 12:20 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
treddie5-Jul-13 19:34
treddie5-Jul-13 19:34 
GeneralRe: Why does .ThreadState.ToString Behave This Way? Pin
Dave Kreskowiak6-Jul-13 4:11
mveDave Kreskowiak6-Jul-13 4:11 
QuestionModules not initializing Pin
treddie4-Jul-13 8:09
treddie4-Jul-13 8:09 
AnswerRe: Modules not initializing Pin
Eddy Vluggen4-Jul-13 9:21
professionalEddy Vluggen4-Jul-13 9:21 
GeneralRe: Modules not initializing Pin
treddie4-Jul-13 10:47
treddie4-Jul-13 10:47 
Questionexcel conditional formatting - or excel control Pin
Member 46241693-Jul-13 4:32
Member 46241693-Jul-13 4:32 
AnswerRe: excel conditional formatting - or excel control Pin
Eddy Vluggen4-Jul-13 5:02
professionalEddy Vluggen4-Jul-13 5:02 
Questionvb.net tree view Pin
walsh273-Jul-13 2:52
walsh273-Jul-13 2:52 
AnswerRe: vb.net tree view Pin
Eddy Vluggen4-Jul-13 3:16
professionalEddy Vluggen4-Jul-13 3:16 
QuestionWebcam Capture and print A5 Paper, Codes (Two Cameras) Pin
Uğur Şirin1-Jul-13 22:57
Uğur Şirin1-Jul-13 22:57 
AnswerRe: Webcam Capture and print A5 Paper, Codes (Two Cameras) Pin
Eddy Vluggen2-Jul-13 0:32
professionalEddy Vluggen2-Jul-13 0:32 
Questionvb6 to vb.net Pin
Smith00530-Jun-13 19:13
Smith00530-Jun-13 19:13 
AnswerRe: vb6 to vb.net Pin
Dave Kreskowiak1-Jul-13 2:21
mveDave Kreskowiak1-Jul-13 2:21 
QuestionHow to get address of a function or method Pin
treddie30-Jun-13 11:05
treddie30-Jun-13 11:05 
AnswerRe: How to get address of a function or method Pin
TnTinMn30-Jun-13 16:46
TnTinMn30-Jun-13 16:46 
GeneralRe: How to get address of a function or method Pin
treddie1-Jul-13 12:17
treddie1-Jul-13 12:17 

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.