home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-dist
/
kaffe-0.5p4-src.tgz
/
tar.out
/
contrib
/
kaffe
/
kaffevm
/
locks.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
1KB
|
62 lines
/*
* locks.h
* Manage locking system
* This include the mutex's and cv's.
*
* Copyright (c) 1996 Systems Architecture Research Centre,
* City University, London, UK.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* Written by Tim Wilkinson <tim@sarc.city.ac.uk>, February-August 1996.
*/
#ifndef __locks_h
#define __locks_h
#include "md.h"
extern int64 waitforever;
#if defined(USE_INTERNAL_THREADS)
struct _thread;
typedef struct _iMux {
struct _thread* holder;
int count;
struct _thread* muxWaiters;
} iMux;
typedef struct _iCv {
struct _thread* cvWaiters;
struct _iMux* mux;
} iCv;
extern void internalLockMutex(iMux*);
extern void internalUnlockMutex(iMux*);
extern void internalWaitCond(iMux*, iCv*, int64);
extern void internalSignalCond(iCv*);
extern void internalBroadcastCond(iCv*);
#define lockMutex(_obj) internalLockMutex(&(_obj)->mux)
#define unlockMutex(_obj) internalUnlockMutex(&(_obj)->mux)
#define waitCond(_obj, _tm) internalWaitCond(&(_obj)->mux,&(_obj)->cv,(_tm))
#define signalCond(_obj) internalSignalCond(&(_obj)->cv)
#define broadcastCond(_obj) internalBroadcastCond(&(_obj)->cv)
#else
/*
* Don't know what we'll do for native threading yet.
*/
#define lockMutex(_obj) ???
#define unlockMutex(_obj) ???
#define waitCond(_obj, _tm) ???
#define signalCond(_obj) ???
#define broadcastCond(_obj) ???
#endif
#endif