Category : thread-synchronization

Description: I have multiple threads (4-32). These threads can all access an array: int resources[1024]. Resources array contains different values (0-1023). There can only be one instance of a single resource(int). Each thread requires different number of resources, which are at some point returned back to the array. Threads can ask for resources more than ..

Read more

i am studying synchronization , and i found this topic the hardest thing i came across in coding thus far ! i really need help , and maybe i will start to understand this subject ! i learned about mutex with simple lock and unlock , and i learned about condition varibales and ( that ..

Read more

I have multiple profiles in Chrome.Profile names are like – Profile 0,Profile 1,…. I am Opening multiple chrome instance with unique profile using CreateProcess(). After that I am assigning each process a thread using CreateThread().Now if i want to open 2 profiles like Profile 0 and Profile 1 using the below code whats happening is ..

Read more

How can I realize synchronization using condition variables in C++/CLI? I’m trying to realize synchronization between two threads. When it comes to C++, I can include mutex and condition_variable. I have an simple C++ code below. #include <mutex> #include <condition_variable> void notify_flag(){ std::this_thread::sleep_for(std::chrono::seconds(3)); { std::lock_guard<std::mutex> lock(mtx); is_ready = true; } cv.notify_one(); } void wait_flag(){ { ..

Read more