samedi 4 février 2017

Thread waiting after a library call deadlock

I have a scenario where ThreadA is receiving certain callback, processing some data and storing it to a store, say TA_Store.

On being notified of a certain event, ThreadA spawns ThreadB. ThreadB then swaps TA_Store to TB_Store (in synchronised way).

ThreadB then takes each item from the TB_Store and makes a synchronous external api call which eventually does a CURL post (libcurl) to an http endpoint. Its at this point, because of a known deadlock scenario in libcurl api call, the ThreadB gets stuck in an infinite wait state as the api never returns.

I want to know what my options are to recover ThreadB from this wait. I can monitor the size of TB_Store if its decreasing or not. If its not then that may point to the deadlock. At this point, I dont mind restarting ThreadB from start on a copy of TB_Store I can keep.

Is there a way to achieve this in C++11/14 or Boost?

I would be glad to get some pointers.

Regards.

Aucun commentaire:

Enregistrer un commentaire