- mutex->lock();
- XBT_INFO("Got mutex. Incrementing count.");
- XBT_INFO("Count is %d", *count);
- *count = (*count) + 1;
- XBT_INFO("Count is now %d. Process count is %d.", *count, process_count);
-
- if (*count == process_count) {
- XBT_INFO("Releasing the semaphore %d times.", process_count-1);
- for (int i = 0; i < process_count-1; i++) {
- semaphore->release();
- }
-
- XBT_INFO("Releasing mutex.");
- mutex->unlock();
- }
- else {
- XBT_INFO("Releasing mutex.");
- mutex->unlock();
- XBT_INFO("Acquiring semaphore.");
- semaphore->acquire();
+ for (auto str : *args) {
+ sem_empty->acquire();
+ XBT_INFO("Pushing '%s'", str.c_str());
+ buffer = str.c_str();
+ sem_full->release();