1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

thread problem

Discussion in 'MFC' started by answerme, Apr 2, 2010.

  1. answerme

    answerme New Member

    Joined:
    Dec 17, 2007
    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    I have created 2 thread In one thread iam reading data through serial.once it read it will go to the second thread.But It seems it never comes out of the first thread itself(read_gps).

    my program goes like this

    Code:
    void CScenGenDoc::OnControlSerialin()
    {
    	upwin=true;	
    	LPVOID param= NULL;
    	LPVOID para=NULL;
    	int a;
    	
     GPS_READ =::CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)[B]read_gps(),([/B]LPVOID) param, 0,NULL);
      GPS_PARSE =::CreateThread(NULL, 0,(LPTHREAD_START_ROUTINE)[B]frameparse(),([/B]LPVOID) para, 0,NULL);
    	
    }


    Code:
    int read_gps()
    {
    while(1)
    {
    bool read=true;
    }
    }

    Code:
    int frameparse()
    {
    while(1)
    { 
    if(read==true)
    {
    ----
    ----
    }
    }
     

Share This Page