2 * Copyright (C) 1998, 1989 Transarc Corporation - All rights reserved
4 * (C) COPYRIGHT IBM CORPORATION 1987, 1988
5 * LICENSED MATERIALS - PROPERTY OF IBM
9 /* Copyright (C) 1994 Cazamar Systems, Inc. */
11 #ifndef _OSILTYPE_H_ENV_
12 #define _OSILTYPE_H_ENV_ 1
14 /* number of dynamic lock types we permit */
15 #define OSI_NLOCKTYPES 32 /* should be enough */
17 /* the set of procedures that we subclass to make a new lock
20 typedef struct osi_lockOps {
21 void (*ObtainReadProc)(struct osi_rwlock *);
22 void (*ObtainWriteProc)(struct osi_rwlock *);
23 void (*ReleaseReadProc)(struct osi_rwlock *);
24 void (*ReleaseWriteProc)(struct osi_rwlock *);
25 void (*ObtainMutexProc)(struct osi_mutex *);
26 void (*ReleaseMutexProc)(struct osi_mutex *);
27 int (*TryReadProc)(struct osi_rwlock *);
28 int (*TryWriteProc)(struct osi_rwlock *);
29 int (*TryMutexProc)(struct osi_mutex *);
30 void (*SleepRProc)(long, struct osi_rwlock *);
31 void (*SleepWProc)(long, struct osi_rwlock *);
32 void (*SleepMProc)(long, struct osi_mutex *);
33 void (*InitializeMutexProc)(struct osi_mutex *, char *);
34 void (*InitializeRWLockProc)(struct osi_rwlock *, char *);
35 void (*FinalizeMutexProc)(struct osi_mutex *);
36 void (*FinalizeRWLockProc)(struct osi_rwlock *);
37 void (*ConvertWToRProc)(struct osi_rwlock *);
38 int (*GetRWLockState)(struct osi_rwlock *);
39 int (*GetMutexState)(struct osi_mutex *);
42 /* operation vectors for lock ops */
43 extern osi_lockOps_t *osi_lockOps[OSI_NLOCKTYPES];
45 extern int osi_lockTypeDefault;
47 /* external procedures */
48 void osi_LockTypeAdd(osi_lockOps_t *, char *, int *);
50 int osi_LockTypeSetDefault(char *);
52 /* bits for GetRWLockInfo and GetMutexInfo return values */
53 #define OSI_MUTEX_HELD 1 /* mutex is held */
54 #define OSI_RWLOCK_READHELD 1 /* locked for read */
55 #define OSI_RWLOCK_WRITEHELD 2 /* locked for write */
57 #endif /* _OSILTYPE_H_ENV_ */