#include <iostream>
#include <sys/neutrino.h>
#include <pthread.h>

int main()
{
  sync_t sync = PTHREAD_MUTEX_INITIALIZER;
  if(SyncMutexLock_r(&sync))
    std::cerr << "First SyncMutexLock_r failed\n";
  if(SyncMutexUnlock_r(&sync))
    std::cerr << "First SyncMutexUnlock_r failed\n";

  //New mutex, by chance has the same address on stack
  sync = PTHREAD_MUTEX_INITIALIZER;
  if(SyncMutexLock_r(&sync))
    std::cerr << "Second SyncMutexLock_r failed\n";
  if(SyncMutexUnlock_r(&sync))
    std::cerr << "Second SyncMutexUnlock_r failed\n";
 
  

  return 0;
}
