mercredi 17 février 2021

pthread_mutex_timedlock vs. c++ 11

I would to ask you a question. I'm porting a legacy source code in a most recent c++ compiler. The embedded system on wich I work uses the standard c++ 11. I have two thread:

  • The first one need to wait for a certain amount of time on a semaphore
  • The second thread, on certain condition, send a signal to a first thread to unlock it.
  • If the first thread goes in timeout, the signal isn't received and the thread process and do some actions.

My question is, there is a class in c++ 11 that can support this kind of behavior.

I see that the semaphore class isn't present in c++1 neither a pthread_mutex_timedlock class implementation.

Could someone suggest an "elegant" way to solve this scenarious?

Thanks in advance, Mauro

Aucun commentaire:

Enregistrer un commentaire