Sunday, November 5, 2017

Is code between ConcurrentQueue wait_and_pop and push thread safe?

Leave a Comment
ConcurrentQueue.wait_and_pop(detector); detector->detect(); ConcurrentQueue.push(detector); 

detector->detect() is not thread safe.

  1. Is the code safe in multithread env if ConcurrentQueue is implemented by mutex? Why?

  2. Is the code safe in multithread env if ConcurrentQueue is implemented by lock free? Why?

0 Answers

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment