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
/
thread.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-28
|
2KB
|
104 lines
/*
* thread.h
* Thread support.
*
* 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 1996.
*/
#ifndef __thread_h
#define __thread_h
#define THREADCLASS "java/lang/Thread"
#define MIN_THREAD_PRIO 1
#define NORM_THREAD_PRIO 5
#define MAX_THREAD_PRIO 10
#define THREAD_SUSPENDED 0
#define THREAD_RUNNING 1
#define THREAD_DEAD 2
#define THREAD_FLAGS_GENERAL 0
#define THREAD_FLAGS_NOSTACKALLOC 1
struct _thread;
typedef struct _ctx {
uint8 status;
uint8 priority;
uint8* restorePoint;
uint8* stackBase;
uint8* stackEnd;
int64 time;
struct _thread* nextlive;
uint8 flags;
#if defined(INTERPRETER)
void* exceptPtr;
#endif
} ctx;
struct _stringClass;
struct _object;
/* This structure mirrors java.lang.ThreadGroup.h */
typedef struct _threadGroup {
object obj;
struct _threadGroup* parent;
struct _object* name;
long maxPrio;
long destroyed;
long daemon;
long nthreads;
struct _object* threads;
long ngroups;
struct _object* groups;
} threadGroup;
/* This structure mirrors java.lang.Thread.h */
typedef struct _thread {
object obj;
object* name;
long priority;
struct _thread* next;
ctx* PrivateInfo;
void* eetop;
long single_step;
long daemon;
long stillborn;
object* target;
long interruptRequested;
threadGroup* group;
} thread;
void initThreads(void);
void startThread(thread*);
void resumeThread(thread*);
void suspendThread(thread*);
void suspendOnQThread(thread*, thread**);
void yieldThread(void);
void killThread(thread*);
void setPriorityThread(thread*, int);
void sleepThread(jlong);
bool aliveThread(thread*);
long framesThread(thread*);
void reschedule(void);
extern int blockInts;
extern bool needReschedule;
#define intsDisable() blockInts++
#define intsRestore() if (blockInts == 1 && needReschedule == true) { \
reschedule(); \
} \
blockInts--
#endif