Click here to Skip to main content
15,909,039 members
Home / Discussions / C#
   

C#

 
QuestionFunction name under execution Pin
Imtiaz Murtaza30-May-08 14:38
Imtiaz Murtaza30-May-08 14:38 
AnswerRe: Function name under execution Pin
MidwestLimey30-May-08 16:57
professionalMidwestLimey30-May-08 16:57 
AnswerRe: Function name under execution Pin
Roger Alsing30-May-08 23:01
Roger Alsing30-May-08 23:01 
Questioninsert byte[] in a file Pin
Xmen Real 30-May-08 14:14
professional Xmen Real 30-May-08 14:14 
AnswerRe: insert byte[] in a file Pin
Anthony Mushrow30-May-08 14:34
professionalAnthony Mushrow30-May-08 14:34 
GeneralRe: insert byte[] in a file Pin
Xmen Real 30-May-08 18:52
professional Xmen Real 30-May-08 18:52 
QuestionMultiThreading\Design Question Pin
DavidBoyd30-May-08 13:36
DavidBoyd30-May-08 13:36 
AnswerRe: MultiThreading\Design Question Pin
RichardM130-May-08 15:31
RichardM130-May-08 15:31 
I agree that "Thread.Sleep(50);" is sleeping the UI thread.
Bad thing to do, generally speaking.

You might want to change the
while(t.ThreadState.ToString() == "Running"){}
into
while(t.ThreadState == ThreadState.Running){}
Strings are slower, and string compare should be done using
String.Compare(string a, string b), not a == b, which does not compare the string content.
There are a number of mechanisms for sharing data between the UI and other threads. A simple one is to have the thread Invoke a call on the form. This will allow the other thread to pass data back to the form with out UI sync problems.
You also need to pass the initial data in to the thread you are starting.
Generally, I create a class that has the threaded method, and holds the data (or references) that are needed. The UI thread creates objects of that class, hands them the data, and tells them to go start themselves. That way you just start them,and don't have to wait for any type of sync events before you start the next.
LMK if that helps.

Learn to write self marginalizing code!
Call 1-888-BAD-CODE
------------------
Silver member by constant and unflinching longevity.

AnswerRe: MultiThreading\Design Question Pin
engsrini31-May-08 12:51
engsrini31-May-08 12:51 
QuestionDisplaying an ASCII value in a dynamic GridView Pin
Ekjon30-May-08 12:43
Ekjon30-May-08 12:43 
AnswerRe: Displaying an ASCII value in a dynamic GridView Pin
Ekjon30-May-08 12:52
Ekjon30-May-08 12:52 
Question[Message Deleted] Pin
Zeeshan Riaz30-May-08 10:34
Zeeshan Riaz30-May-08 10:34 
AnswerRe: Copy Constructor Pin
#realJSOP30-May-08 10:39
professional#realJSOP30-May-08 10:39 
AnswerRe: Copy Constructor Pin
MarkB77730-May-08 13:42
MarkB77730-May-08 13:42 
AnswerRe: Copy Constructor Pin
Bert delaVega30-May-08 15:06
Bert delaVega30-May-08 15:06 
AnswerCP IGNORE Pin
leckey30-May-08 18:17
leckey30-May-08 18:17 
Question[Message Deleted] Pin
Zeeshan Riaz30-May-08 10:32
Zeeshan Riaz30-May-08 10:32 
AnswerRe: Generalization Pin
Guffa30-May-08 13:50
Guffa30-May-08 13:50 
AnswerDO YOUR OWN HOMEWORK Pin
leckey30-May-08 18:16
leckey30-May-08 18:16 
Question[Message Deleted] Pin
Zeeshan Riaz30-May-08 10:30
Zeeshan Riaz30-May-08 10:30 
AnswerRe: Reflection Pin
#realJSOP30-May-08 10:40
professional#realJSOP30-May-08 10:40 
GeneralRe: Reflection Pin
Pete O'Hanlon30-May-08 10:45
mvePete O'Hanlon30-May-08 10:45 
AnswerRe: Reflection Pin
MarkB77730-May-08 13:38
MarkB77730-May-08 13:38 
AnswerRe: Reflection Pin
engsrini31-May-08 12:46
engsrini31-May-08 12:46 
Question[Message Deleted] Pin
Zeeshan Riaz30-May-08 10:28
Zeeshan Riaz30-May-08 10: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.