×

INDI Library v1.9.3 Released (11 Nov 2021)

Bimonthly Stable INDI Library release introduces new drivers and fixes for existing ones. Some highlights:

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 months 4 days ago by Pedram. Reason: Bad formatting
2 months 4 days 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 months 3 days ago #76259

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

Time to create page: 0.478 seconds