#include <stdio.h>
#include "lock.h"

Lock *make_lock ()
{
  Lock *lock = (Lock *) malloc (sizeof(Lock));
  lock->value = 0;
  return lock;
}

void acquire (Lock *lock)
{
  while (lock->value == 1);
  lock->value = 1;
}

void release (Lock *lock)
{
  lock->value = 0;
}
