/** * Esta clase encapsula las funciones para la utilizacion de variables de condición * * Autor: Programacion Paralela y Concurrente * * Fecha: 2025/Oct/31 * **/ #include "Condition.h" /* * Creates a new condition variable * * Uses an internal structure to make workers wait for resources * **/ Condition::Condition() { this->workers = 0; // To be completed by students } /** * Destroys our condition variable **/ Condition::~Condition() { // To be completed by students } /** * Wait for the condition controlled by our variable * **/ void Condition::Wait( Lock * affectedLock ) { this->workers++; // To be completed by students } /** * Notify one worker from the queue, if empty has no effect * **/ void Condition::NotifyOne() { // To be completed by students } /** * Same method as notify one, declared for compatibility with many examples * **/ void Condition::Signal() { // To be completed by students } /** * Signal all workers from the queue, if empty has no effect * **/ void Condition::NotifyAll() { while ( this->workers > 0 ) { this->workers--; // To be completed by students } }