Skip to content
Snippets Groups Projects
Commit 4ebfefec authored by qwertzniki6's avatar qwertzniki6
Browse files

Fixed wrong refractoring

parent a8d442c9
No related branches found
No related tags found
No related merge requests found
......@@ -39,17 +39,17 @@ namespace ConsoleApplication1
else
{
Thread.Sleep(_random.Next(500, 1500));
Mutex m = _buffer.getMutex();
Mutex m = _buffer.GetMutex();
m.WaitOne();
if (_buffer.full())
if (_buffer.Full())
{
Producer.WakeUp();
}
if (!_buffer.empty())
if (!_buffer.Empty())
{
Car c = _buffer.pop();
Car c = _buffer.Pop();
Console.WriteLine("car pulled out of parking space. car id = " + c.getThisCarId());
}
......
......@@ -41,18 +41,18 @@ namespace ConsoleApplication1
else
{
Thread.Sleep(_random.Next(500, 1500));
Mutex m = _buffer.getMutex();
Mutex m = _buffer.GetMutex();
m.WaitOne();
if (_buffer.empty())
if (_buffer.Empty())
{
Consumer.WakeUp();
}
if (!_buffer.full())
if (!_buffer.Full())
{
Car c = new Car();
_buffer.push(c);
_buffer.Push(c);
Console.WriteLine("car " + c.getThisCarId() + " added");
}
//if buffer is full: producers are set to sleep, own instance is set to sleep
......
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment