32 #ifndef _INCLUDE_SOURCEMOD_THREADER_H 
   33 #define _INCLUDE_SOURCEMOD_THREADER_H 
   44 #define SMINTERFACE_THREADER_NAME               "IThreader" 
   45 #define SMINTERFACE_THREADER_VERSION    3 
   61                 Thread_AutoRelease = 1,
 
   65                 Thread_CreateSuspended = 2,
 
   73                 ThreadPrio_Minimum = -8,
 
   75                 ThreadPrio_Normal = 0,
 
   77                 ThreadPrio_Maximum = 8,
 
   97                         flags(Thread_Default), 
 
   98                         prio(ThreadPrio_Normal)
 
  262                 virtual void Lock() =0;
 
  287                 virtual void Wait() =0;
 
  335                 virtual bool Pause() =0;
 
  349                 virtual bool Start() =0;
 
  358                 virtual bool Stop(
bool flush) =0;
 
  366                 virtual WorkerState 
GetStatus(
unsigned int *numThreads) =0;
 
  419                         return SMINTERFACE_THREADER_NAME;
 
  423                         return SMINTERFACE_THREADER_VERSION;
 
  474 #endif //_INCLUDE_SOURCEMOD_THREADER_H 
virtual void DestroyWorker(IThreadWorker *pWorker)=0
Destroys an IThreadWorker pointer. 
ThreadPriority prio
Definition: IThreader.h:102
Describes thread worker callbacks. 
Definition: IThreader.h:389
virtual void OnWorkerStart(IThreadWorker *pWorker)
Called when the worker thread is initialized. 
Definition: IThreader.h:397
virtual void GetPriorityBounds(ThreadPriority &max, ThreadPriority &min)=0
Returns the priority bounds. Note: On Linux, the min and max are both Thread_Normal. 
virtual bool WaitForThread()=0
Pauses parent thread until this thread completes. 
Defines the Share System, responsible for shared resources and dependencies. 
virtual void ThreadSleep(unsigned int ms)=0
Sleeps the calling thread for a number of milliseconds. 
virtual ThreadPriority GetPriority()=0
Returns the thread priority. 
This is a "worker pool." A single thread places tasks in a queue. Each IThread is then a task...
Definition: IThreader.h:315
virtual const char * GetInterfaceName()
Must return a string defining the interface's unique name. 
Definition: IThreader.h:417
Defines the base functionality required by a shared interface. 
Definition: IShareSys.h:92
Describes a simple "condition variable"/signal lock. 
Definition: IThreader.h:278
virtual IMutex * MakeMutex()=0
Creates a mutex (mutual exclusion lock). 
virtual bool Pause()=0
Pauses the worker. 
virtual void Lock()=0
Attempts to lock by waiting for release. 
Thread-specific parameters. 
Definition: IThreader.h:93
virtual bool IsVersionCompatible(unsigned int version)
Must return whether the requested version number is backwards compatible. Note: This can be overridde...
Definition: IThreader.h:425
virtual ~IMutex()
Definition: IThreader.h:250
virtual IThreadCreator * Parent()=0
Returns the parent threader. 
virtual void DestroyThis()=0
Destroys the mutex handle. 
virtual void GetParams(ThreadParams *ptparams)=0
Returns the thread states. 
virtual void RunThread(IThreadHandle *pHandle)=0
Called when the thread runs (in its own thread). 
ThreadFlags flags
Definition: IThreader.h:100
virtual void SetThinkTimePerFrame(unsigned int thinktime)=0
For threaded workers, the think time of a frame. Has no effect for non-threaded workers. Default value is 50ms. 
virtual bool TryLock()=0
Attempts to lock, but returns instantly. 
Describes a handle to a thread. 
Definition: IThreader.h:110
virtual void OnTerminate(IThreadHandle *pHandle, bool cancel)=0
Called when the thread terminates. This occurs inside the thread as well. 
virtual void DestroyThis()=0
Frees the signal handle. 
Describes a threading system. 
Definition: IThreader.h:414
virtual void OnWorkerStop(IThreadWorker *pWorker)
Called when the worker thread is cleaning up. 
Definition: IThreader.h:406
virtual bool Unpause()=0
Unpauses the worker. 
virtual void DestroyThis()=0
Destroys the thread handle. This will not necessarily cancel the thread. 
virtual void MakeThread(IThread *pThread)=0
Creates a basic thread. 
virtual ~IEventSignal()
Definition: IThreader.h:282
virtual bool Stop(bool flush)=0
Stops the worker thread. 
virtual IEventSignal * MakeEventSignal()=0
Creates a non-signalled event. 
virtual ~IThread()
Definition: IThreader.h:180
virtual bool IsVersionCompatible(unsigned int version)
Must return whether the requested version number is backwards compatible. Note: This can be overridde...
Definition: IShareSys.h:112
Definition: IAdminSystem.h:63
virtual ~IThreadCreator()
Definition: IThreader.h:206
virtual void Unlock()=0
Unlocks the mutex. 
virtual WorkerState GetStatus(unsigned int *numThreads)=0
Returns the status of the worker. 
virtual ThreadState GetState()=0
Returns the thread state. 
Describes a simple locking mutex. 
Definition: IThreader.h:246
virtual unsigned int RunFrame()=0
Runs one "frame" of the worker. 
virtual ~IThreadWorker()
Definition: IThreader.h:319
virtual bool SetPriority(ThreadPriority prio)=0
Sets thread priority. NOTE: On Linux, this always returns false. 
virtual IThreadWorker * MakeWorker(IThreadWorkerCallbacks *hooks, bool threaded)=0
Creates a thread worker. 
Handles a single thread's execution. 
Definition: IThreader.h:176
virtual bool Unpause()=0
Attempts to unpause a paused thread. 
virtual bool Start()=0
Starts the worker thread. 
Describes a thread creator. 
Definition: IThreader.h:202
virtual unsigned int GetInterfaceVersion()
Must return an integer defining the interface's version. 
Definition: IThreader.h:421
virtual void SetMaxThreadsPerFrame(unsigned int threads)=0
Sets the number of threads to run per frame. Default value is 1 thread per frame. ...
virtual void Wait()=0
Waits for a signal. 
ThreadParams()
Definition: IThreader.h:96
virtual void Signal()=0
Triggers the signal and resets the signal after triggering. 
virtual ~IThreadHandle()
Definition: IThreader.h:114