Category : multithreading

I have a WorkDispatcher class which holds Worker class objects as properties and launches their function in new threads. Here is a example: WorkDispatcher.h: class WorkDispatcher { private: std::thread m_reconstructionThread; std::shared_ptr <Reconstruction::RGBDImageModel> m_currentRGBD; public: WorkDispatcher(); std::mutex m_rgbdMutex, m_commandMutex; std::deque<Network::NetworkCommandModel> m_CommandQueue; std::condition_variable m_RgbConditional, m_CommandConditional; Reconstruction::SceneReconstructor m_Reconstructor; void Initialize(); void Work(); void Stop(); }; WorkDispatcher.cpp: void WorkDispatcher::Work() ..

Read more

I am trying to instantiate two threads, running the same function, on two separate data inputs. I keep getting errors C2672, C2893, and C2780. What am I doing wrong? I’ve included the minimum below to show what I am trying to achieve. #include <iostream> #include <vector> #include <thread> using namespace std; vector<double> someFunction(vector<double> input) { ..

Read more

Create a task engine, which is nothing but an always running (single) thread that keeps running forever. It keeps waiting for tasks to be submitted to it (asynchronously) and once it finds a task to process, it picks it up, processes it and goes back to waiting for more tasks. There are a number of ..

Read more