Category : posix

I’m helping a student with their homework, which is a basic threading exercise. Unfortunately, though they’re required to use C++11, they’re forbidden from using std::thread. I don’t see the rationale, but it’s not my homework. Here’s the class: class VaccineInfo { public: VaccineInfo(const std::string &t_input_filename): input_filename(t_input_filename) { } VaccineInfo() = delete; static void *count_vaccines(void *t_vi); ..

Read more

I am trying to understand the thread join in C / C++. And I get to know that std::thread::join() function makes the current thread wait until the thread identified by *this has finished executing. But I can’t understand why the positioning of the join function is important and why this two code works differently. code ..

Read more

I have a program (let’s call it the consumer) that opens and keeps reading a file. The file is created and written by another program (let’s call it the producer). Some times, the file gets deleted (manually) and recreated by the producer. The problem is, the consumer doesn’t know that and keeps reading the old ..

Read more

I am working on a project to write a plugin, using websocketpp to support web socket connections.  The main system process will fork a child process and that child will wait (a short wait) until the parent tells that child to perform a task.  The main system code uses asio and the parent process already ..

Read more