×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

Automatically exit gracefully after conditions are met

  • Posts: 9
  • Thank you received: 0
Hi all :) I am developing a simple rotator client that takes a few arguments, connects to the rotator (currently a simulator), and it should just exit the program after reaching its destination. However, if I simply use
exit(0);
after reaching the destination the program complains
BaseClient::~BaseClient: Probability of detecting a deadlock.

I am wondering what is the clean way to exit the program after reaching certain conditions without the need of human intervention? Should I just write a `while(true)` loop and check for conditions in the `main` function? If so, I am worried about blocking the CPU. Should I be worried?

Thanks in advance,
Pedram

Warning: Spoiler!
Last edit: 2 years 6 months ago by Pedram. Reason: Bad formatting
2 years 6 months ago #76253

Please Log in or Create an account to join the conversation.

  • Posts: 9
  • Thank you received: 0
I found out about using condition variable [1] and implemented one to get this behavior. Thanks anyways :)

[1] en.cppreference.com/w/cpp/thread/condition_variable
2 years 6 months ago #76259

Please Log in or Create an account to join the conversation.

Time to create page: 0.473 seconds