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

C#

 
QuestionHow to Improve Win From's Graphics !! Pin
mrkeivan19-Apr-06 3:21
mrkeivan19-Apr-06 3:21 
AnswerRe: How to Improve Win From's Graphics !! Pin
LongRange.Shooter19-Apr-06 3:35
LongRange.Shooter19-Apr-06 3:35 
GeneralRe: How to Improve Win From's Graphics !! Pin
mrkeivan19-Apr-06 3:39
mrkeivan19-Apr-06 3:39 
GeneralRe: How to Improve Win From's Graphics !! Pin
LongRange.Shooter19-Apr-06 3:52
LongRange.Shooter19-Apr-06 3:52 
AnswerRe: How to Improve Win From's Graphics !! Pin
Robert Rohde19-Apr-06 4:48
Robert Rohde19-Apr-06 4:48 
Questiondataset problem Pin
Khepry19-Apr-06 3:17
Khepry19-Apr-06 3:17 
AnswerRe: dataset problem Pin
LongRange.Shooter19-Apr-06 3:30
LongRange.Shooter19-Apr-06 3:30 
Questionpopup menu Pin
vatzcar19-Apr-06 3:11
vatzcar19-Apr-06 3:11 
AnswerRe: popup menu Pin
LongRange.Shooter19-Apr-06 3:26
LongRange.Shooter19-Apr-06 3:26 
QuestionEditing an XML node in C# Pin
AnneThorne19-Apr-06 2:48
AnneThorne19-Apr-06 2:48 
AnswerRe: Editing an XML node in C# Pin
LongRange.Shooter19-Apr-06 3:19
LongRange.Shooter19-Apr-06 3:19 
AnswerRe: Editing an XML node in C# Pin
conrado719-Apr-06 3:32
conrado719-Apr-06 3:32 
QuestionBluetooth in C# Pin
hschutte19-Apr-06 2:21
hschutte19-Apr-06 2:21 
AnswerRe: Bluetooth in C# Pin
LongRange.Shooter19-Apr-06 3:24
LongRange.Shooter19-Apr-06 3:24 
QuestionHTMLdocument and Webclient/Webbrowser Pin
ranzask19-Apr-06 2:12
ranzask19-Apr-06 2:12 
AnswerRe: HTMLdocument and Webclient/Webbrowser Pin
Ed.Poore19-Apr-06 9:19
Ed.Poore19-Apr-06 9:19 
AnswerRe: HTMLdocument and Webclient/Webbrowser Pin
Ravi Bhavnani19-Apr-06 9:26
professionalRavi Bhavnani19-Apr-06 9:26 
GeneralRe: HTMLdocument and Webclient/Webbrowser Pin
ranzask19-Apr-06 9:40
ranzask19-Apr-06 9:40 
GeneralRe: HTMLdocument and Webclient/Webbrowser Pin
Ravi Bhavnani19-Apr-06 9:47
professionalRavi Bhavnani19-Apr-06 9:47 
QuestionThreading program Pin
eric_tran19-Apr-06 1:52
eric_tran19-Apr-06 1:52 
AnswerRe: Threading program Pin
LongRange.Shooter19-Apr-06 5:26
LongRange.Shooter19-Apr-06 5:26 
I'd say your ReadInput thread would end as soon as someone types '+'.
Your ReadOutput thread would end almost as soon as you started it.

To keep your threads alive you need to keep them doing something. So once your thread is initialized, you need to manage it with a while loop:

bool notTerminated = true;
public  bool NotTerminated { get; set; }

while ( NotTerminated )
{
     // process...
     Threading.Thread.Sleep(50);
}


Your loader program (containing Main()) would handle the passage of data.
So it would sit in a while loop looking to see if there is something to move out of the first thread. If there is, then it moves it to the second thread and that thread does it's thing.

You could use the get; set; logic for the payload in thread one to change the state for notifying the Main() process.

private bool dataAvailable;
private DataClass mydataload;
public DataClass PayLoad
{
    get {
        if (dataAvailable)
        {
            dataAvailable = false;
            return mydataload;
        } else return null;
    set {
        dataAvailable=true;
        PayLoad = value; }
 }


This snippet can be supported in both threads. Your Main() thread checks the state of available data in thread one. Thread two in it's main loop checks it's own state for DataAvailable.


-- modified at 11:26 Wednesday 19th April, 2006
GeneralRe: Threading program Pin
eric_tran19-Apr-06 5:48
eric_tran19-Apr-06 5:48 
QuestionUninstall link in deployment project Pin
Stefan Troschuetz19-Apr-06 1:41
Stefan Troschuetz19-Apr-06 1:41 
Questiondiscusiion forum Pin
prgramya19-Apr-06 1:41
prgramya19-Apr-06 1:41 
AnswerRe: discusiion forum Pin
J4amieC19-Apr-06 2:36
J4amieC19-Apr-06 2:36 

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.