1 /***************************************************************************
3 * Copyright (C) Lakshya Solutions Ltd. All rights reserved. *
5 ***************************************************************************/
14 #if defined(sparc) || defined(i686) || defined (x86_64)
17 pthread_mutex_t mutex_
;
24 int tryLock(int tries
=0, int waitmsecs
=0);
25 int getLock(int procSlot
, bool procAccount
=true);
26 int releaseLock(int procSlot
, bool procAccount
=true);
27 int tryShareLock(int tries
=0, int waitmsecs
=0,bool share
=false,bool upgrade
=false);
28 int getShareLock(int procSlot
, bool procAccount
=true);
29 int getExclusiveLock(int procSlot
, bool procAccount
=true,bool upgrade
=false);
30 int releaseShareLock(int procSlot
, bool procAccount
=true);
33 static int CASGen(void *ptr
, InUse oldVal
, InUse newVal
);
34 static int CASL(long *ptr
, long oldVal
, long newVal
);
35 static int CAS(int *ptr
, int oldVal
, int newVal
);
36 int getLockVal(){ return lock
; }
38 printf("Mutex: %d %s\n", lock
, name
);