Click here to Skip to main content
15,867,308 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: discusiion forum Pin
LongRange.Shooter19-Apr-06 3:57
LongRange.Shooter19-Apr-06 3:57 
QuestionDetect when new application opened? Pin
Werner Vos19-Apr-06 1:32
Werner Vos19-Apr-06 1:32 
QuestionDirectoryNotFoundException when directory does exist Pin
sergestusxx19-Apr-06 1:19
sergestusxx19-Apr-06 1:19 
AnswerRe: DirectoryNotFoundException when directory does exist Pin
mav.northwind19-Apr-06 2:00
mav.northwind19-Apr-06 2:00 
AnswerRe: DirectoryNotFoundException when directory does exist Pin
LongRange.Shooter19-Apr-06 4:02
LongRange.Shooter19-Apr-06 4:02 
AnswerRe: DirectoryNotFoundException when directory does exist Pin
theDexter19-Apr-06 8:50
theDexter19-Apr-06 8:50 
GeneralRe: DirectoryNotFoundException when directory does exist Pin
sergestusxx19-Apr-06 9:29
sergestusxx19-Apr-06 9:29 
QuestionRegarding WEB TV Pin
veerasekar Muthiah19-Apr-06 0:27
veerasekar Muthiah19-Apr-06 0:27 
AnswerRe: Regarding WEB TV Pin
LongRange.Shooter19-Apr-06 4:13
LongRange.Shooter19-Apr-06 4:13 
QuestionWindows Form Datagrid ? Pin
Gammaza19-Apr-06 0:24
Gammaza19-Apr-06 0:24 
QuestionSystem.Nullable(of Short) - How do I pass Null ... Pin
MaWeRic19-Apr-06 0:06
MaWeRic19-Apr-06 0:06 
AnswerRe: System.Nullable(of Short) - How do I pass Null ... Pin
Jon Hulatt19-Apr-06 0:35
Jon Hulatt19-Apr-06 0:35 
Questionproblem with visio shape object. Can't acces 'Class' class name, fields etc. Pin
crazymubashir19-Apr-06 0:04
crazymubashir19-Apr-06 0:04 

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.