Skip to content

[Windows] osDeleteTask() problem #27

@gvanem

Description

@gvanem

Building and running http_server.exe on Windows with good-ol'e WinPcap works great:
cyclonetcp

But pressing q to quit the program does not work. Adding some trace-code,
I see that WaitforSingleObject() in main() never returns!

I modified userTask():

        static int user_task_deleted = 0;
        ....
         else if(toupper(ch) == 'Q')
         {
            //Kill ourselves
            TRACE_INFO ("calling 'osDeleteTask()'\n");
            user_task_deleted = 1;
            osDeleteTask(OS_SELF_TASK_ID);
         }

and main():

  #define WAIT_TIMEOUT 258
 
   //Wait until the user task has terminated
   while (1)
   {
     TRACE_INFO ("user_task_deleted: %d\n", user_task_deleted);
     if (WaitForSingleObject(taskId, 10000) != WAIT_TIMEOUT)
        break;
   }

The while (1) loop never quits and the trace never shows a user_task_deleted: 1.

The only fix for me was to replace osDeleteTask(OS_SELF_TASK_ID); with ExitProcess(0);.

Someone please explain this.

PS. I built everything with bare minimum of features from git master some days ago (with cl and clang-cl) and
      the latest CycloneTCP_SSL_*.zip from https://www.oryx-embedded.com/download/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions