folly
folly copied to clipboard
MPMCQueue blockingRead() doesn't return even with a subsequent write()
An example to demonstrate it:
#include <iostream>
#include <thread>
#include "folly/MPMCQueue.h"
int main() {
folly::MPMCQueue<int> q(1024);
std::thread t([&q](){
int i;
std::cout << q.size() << std::endl;
q.blockingRead(i); // never wake up
std::cout << q.size() << std::endl;
std::cout << i << std::endl;
});
sleep(1);
std::cout << q.size() << std::endl;
q.write(333);
std::cout << q.size() << std::endl;
while(true);
}
Interestingly, this only happens when running inside a Ubuntu20 docker on a Mac. It runs as expected in a native Ubuntu20 VM on AWS.