#ifndef NSPR_LOCK_H
#define NSPR_LOCK_H

#ifdef TPS
 #include <nucleus.h>
 typedef NU_SEMAPHORE CNLock;
 enum eCNStatus { PR_FAILURE = -1, PR_SUCCESS = 0 };
#else
 #include <windows.h>
 typedef CRITICAL_SECTION CNLock;
 typedef enum eCNStatus { PR_FAILURE = -1, PR_SUCCESS = 0 };
#endif

//typedef enum { CN_FAILURE = -1, CN_SUCCESS = 0 } CNStatus;
//typedef enum eCNStatus { CN_FAILURE = -1, CN_SUCCESS = 0 };

typedef enum eCNStatus CNStatus;

#define PR_INTERVAL_NO_TIMEOUT INFINITE

typedef CNLock PRLock;
typedef CNStatus PRStatus;

CNLock* CN_NewLock();
void CN_DestroyLock(CNLock* lock);
void CN_Lock(CNLock* lock);
CNStatus CN_Unlock(CNLock* lock);

#endif