Click here to Skip to main content
15,910,471 members
Home / Discussions / C#
   

C#

 
GeneralRe: how to use event to re-write this code segment? Pin
PIEBALDconsult1-Jun-08 19:26
mvePIEBALDconsult1-Jun-08 19:26 
GeneralRe: how to use event to re-write this code segment? Pin
George_George2-Jun-08 0:52
George_George2-Jun-08 0:52 
GeneralRe: how to use event to re-write this code segment? Pin
PIEBALDconsult2-Jun-08 9:07
mvePIEBALDconsult2-Jun-08 9:07 
GeneralRe: how to use event to re-write this code segment? Pin
George_George3-Jun-08 1:36
George_George3-Jun-08 1:36 
GeneralRe: how to use event to re-write this code segment? Pin
PIEBALDconsult3-Jun-08 17:59
mvePIEBALDconsult3-Jun-08 17:59 
GeneralRe: how to use event to re-write this code segment? Pin
George_George3-Jun-08 18:27
George_George3-Jun-08 18:27 
GeneralRe: how to use event to re-write this code segment? Pin
PIEBALDconsult3-Jun-08 18:49
mvePIEBALDconsult3-Jun-08 18:49 
GeneralRe: how to use event to re-write this code segment? Pin
George_George3-Jun-08 19:00
George_George3-Jun-08 19:00 
Thanks PIEBALDconsult,


This is not homework. Just my interest to find alternative solutions. Smile | :)

Here is my question showed by the code, it seems there is no way to check whether the signal is set or not after WaitOne(1000) returns, right? So, we can not just use a singal to check the stop condition for a thread, and we need some other approaches to check?

(my previous ideas is to check whether the signal is set or not, if it is set after WaitOne(1000), then I can stop the thread, but after MSDN document study, seems no way to check whether a signal is set or not after WaitOne(1000)?)

static void ThreadMethod3()
{
    while (true)
    {
        CheckEvent.WaitOne (1000);
        // we can not know whether the event is set or not here?
        Console.WriteLine(DateTime.Now);
         // do some work
    }
}



regards,
George
GeneralRe: how to use event to re-write this code segment? Pin
PIEBALDconsult3-Jun-08 19:03
mvePIEBALDconsult3-Jun-08 19:03 
QuestionHow can I create own Browser? Pin
lockepeak1-Jun-08 14:08
lockepeak1-Jun-08 14:08 
AnswerRe: How can I create own Browser? Pin
Christian Graus1-Jun-08 15:54
protectorChristian Graus1-Jun-08 15:54 
QuestionReading Registry Key Problem. Pin
Jammer1-Jun-08 13:56
Jammer1-Jun-08 13:56 
AnswerRe: Reading Registry Key Problem. Pin
Sujith C Jose2-Jun-08 2:58
Sujith C Jose2-Jun-08 2:58 
QuestionCan I find out how many dataset are in a project? Pin
belzer1-Jun-08 11:20
belzer1-Jun-08 11:20 
AnswerRe: Can I find out how many dataset are in a project? Pin
Christian Graus1-Jun-08 15:54
protectorChristian Graus1-Jun-08 15:54 
GeneralRe: Can I find out how many dataset are in a project? Pin
belzer2-Jun-08 4:21
belzer2-Jun-08 4:21 
QuestionCan we declare method with optional parameters ? Pin
Mohammad Dayyan1-Jun-08 9:43
Mohammad Dayyan1-Jun-08 9:43 
AnswerRe: Can we declare method with optional parameters ? Pin
Giorgi Dalakishvili1-Jun-08 9:53
mentorGiorgi Dalakishvili1-Jun-08 9:53 
AnswerRe: Can we declare method with optional parameters ? Pin
Scott Dorman1-Jun-08 17:05
professionalScott Dorman1-Jun-08 17:05 
AnswerRe: Can we declare method with optional parameters ? Pin
Jaime Olivares1-Jun-08 19:21
Jaime Olivares1-Jun-08 19:21 
GeneralRe: Can we declare method with optional parameters ? Pin
Mohammad Dayyan1-Jun-08 22:26
Mohammad Dayyan1-Jun-08 22:26 
QuestionHow to prevent to changing row in DataGridView when user is edit Mode ? Pin
hdv2121-Jun-08 7:46
hdv2121-Jun-08 7:46 
Questionftp treeview Pin
jammmie9991-Jun-08 1:27
professionaljammmie9991-Jun-08 1:27 
AnswerRe: ftp treeview Pin
Christian Graus1-Jun-08 4:00
protectorChristian Graus1-Jun-08 4:00 
QuestionCheck Box in grid view Pin
venkat86_ece31-May-08 23:54
venkat86_ece31-May-08 23:54 

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.