//
// File defining fields in the Yap_GLOBAL global structure
//
// these fields used to spread all over the place, because they must be used in 3 ways:
//  - they must be defined somewhere
//  - they have an #ifdef to get a shorter name
//  - they must be initialised somewhere
//  - they may be of interest to restore
//
// The defs include 3+ components:
//   Type
//   name in structured / global name 
//   init code (optional)
//   restore code (optional)
//

// Stuff that must be shared by all threads or workers
START_GLOBAL_DATA

// initialization: tell whether the system has been initialised and by whom.
int		Initialised			=FALSE
int		InitialisedFromPL		=FALSE
int		PL_Argc				=0
char**		PL_Argv				=NULL

// halt hooks
struct halt_hook*	HaltHooks		=NULL

// stack overflow expansion/gc control
int		AllowLocalExpansion 		=TRUE
int		AllowGlobalExpansion 		=TRUE
int		AllowTrailExpansion 		=TRUE
UInt		SizeOfOverflow			=0

// amount of space recovered in all garbage collections
UInt		AGcThreshold			=10000
Agc_hook	AGCHook				=NULL

/* multi-thread support */
#if THREADS
/* number of threads and processes in system */
UInt		NOfThreads			=1
/* number of threads created since start */
UInt		NOfThreadsCreated 		=1
/* total run time for dead threads */
UInt  		ThreadsTotalTime 		=0L
// Threads Array
lockvar		ThreadHandlesLock		MkLock
#endif

#if defined(YAPOR) || defined(THREADS)
// protect long critical regions
lockvar		BGL				MkLock
#endif

#if defined(YAPOR) || defined(TABLING)
struct global_optyap_data	optyap_data	void	
#endif /* YAPOR || TABLING */

END_GLOBAL_DATA