COMMENT @----------------------------------------------------------------------

	Copyright (c) GeoWorks 1989 -- All Rights Reserved

PROJECT:	PC GEOS
FILE:		thread.def

DECLARER:	Kernel

DESCRIPTION:
	This file defines multi-tasking structures and routines.

	$Id: thread.def,v 1.1 97/04/04 14:24:13 newdeal Exp $

------------------------------------------------------------------------------@

SetDef	__THREAD

StartKernel

global ThreadDestroy:far
global ThreadCreate:far
global ThreadCreateVirtual:far	; like ThreadCreate, but takes a virtual far
				;  pointer for the starting point for the thread
				;  (no C stub, b/c THREADCREATE already takes
				;  a virtual far pointer)
global ThreadGetInfo:far
global ThreadModify:far
global ThreadAttachToQueue:far
global ThreadPrivAlloc:far
global ThreadPrivFree:far
global ThreadHandleException:far

;-

global THREADDESTROY:far
global THREADCREATE_OLD:far
global THREADCREATE:far
global THREADGETINFO:far
global THREADMODIFY:far
global THREADATTACHTOQUEUE:far
global THREADPRIVALLOC:far
global THREADPRIVFREE:far
global THREADHANDLEEXCEPTION:far

;------------------------------------------------------------------------------
;	Paramters to ThreadGetInfo
;------------------------------------------------------------------------------

ThreadGetInfoType	etype	protominor word, 0, 2
TGIT_PRIORITY_AND_USAGE	enum	ThreadGetInfoType
TGIT_THREAD_HANDLE	enum	ThreadGetInfoType
TGIT_QUEUE_HANDLE	enum	ThreadGetInfoType
	protominor KernelNewForMailbox
TGIT_STACK_SEGMENT	enum	ThreadGetInfoType
	protoreset

;--------------------------------------------------------------------------
;		Constants for thread priorities
;--------------------------------------------------------------------------

ThreadPriority 	etype byte

PRIORITY_TIME_CRITICAL 	enum ThreadPriority, 0
PRIORITY_HIGH		enum ThreadPriority, 64	;IM
PRIORITY_UI		enum ThreadPriority, 96	;UI
PRIORITY_FOCUS		enum ThreadPriority, 128	;FOCUS
PRIORITY_STANDARD	enum ThreadPriority, 160	;STD
PRIORITY_LOW		enum ThreadPriority, 192	;BACKGROUND
PRIORITY_LOWEST		enum ThreadPriority, 254	;Used by kernel
PRIORITY_IDLE		enum ThreadPriority, 255	;IDLE only runs when
							; no other threads are
							; runnable	

;--------------------------------------------------------------------------
;		Constants for ThreadModify
;--------------------------------------------------------------------------

ThreadModifyFlags	record
    TMF_BASE_PRIO:1
    TMF_ZERO_USAGE:1
    :6
ThreadModifyFlags	end

;--------------------------------------------------------------------------
;		Constants for ThreadHandleException
;--------------------------------------------------------------------------
ThreadException	etype	word, 0, 4
    TE_DIVIDE_BY_ZERO	enum	ThreadException
    TE_OVERFLOW		enum	ThreadException
    TE_BOUND		enum	ThreadException
    TE_FPU_EXCEPTION	enum	ThreadException
    TE_SINGLE_STEP	enum	ThreadException
    TE_BREAKPOINT	enum	ThreadException

EndKernel
