Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] osDeleteTask() problem #27

Open
gvanem opened this issue Jan 20, 2024 · 0 comments
Open

[Windows] osDeleteTask() problem #27

gvanem opened this issue Jan 20, 2024 · 0 comments

Comments

@gvanem
Copy link

gvanem commented Jan 20, 2024

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant