Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

threads.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int GetThreadWork (void)
void RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int))
void RunThreadsOnIndividual (int workcnt, qboolean showpacifier, void(*func)(int))
void ThreadLock (void)
void ThreadSetDefault (void)
void ThreadUnlock (void)

Variables

int numthreads


Function Documentation

int GetThreadWork void   ) 
 

Definition at line 45 of file l_threads.c.

References _printf(), dispatch, f, oldf, printf(), r, ThreadLock(), and ThreadUnlock().

00046 {
00047     int r;
00048     int f;
00049 
00050     ThreadLock();
00051 
00052     if (dispatch == workcount)
00053     {
00054         ThreadUnlock ();
00055         return -1;
00056     }
00057 
00058     f = 10*dispatch / workcount;
00059     if (f != oldf)
00060     {
00061         oldf = f;
00062         if (pacifier)
00063             printf ("%i...", f);
00064     } //end if
00065 
00066     r = dispatch;
00067     dispatch++;
00068     ThreadUnlock ();
00069 
00070     return r;
00071 } //end of the function GetThreadWork

Here is the call graph for this function:

void RunThreadsOn int  workcnt,
qboolean  showpacifier,
void(*)(int)  func
 

Definition at line 1448 of file l_threads.c.

References _printf(), dispatch, func(), I_FloatTime(), Log_Print(), NULL, oldf, pacifier, printf(), setbuf(), stdout, and workcount.

Referenced by RunThreadsOnIndividual().

01449 {
01450     int start, end;
01451 
01452     Log_Print("no multi-threading\n");
01453     dispatch = 0;
01454     workcount = workcnt;
01455     oldf = -1;
01456     pacifier = showpacifier;
01457     start = I_FloatTime (); 
01458 #ifdef NeXT
01459     if (pacifier)
01460         setbuf (stdout, NULL);
01461 #endif
01462     func(0);
01463 
01464     end = I_FloatTime ();
01465     if (pacifier)
01466         printf (" (%i)\n", end-start);
01467 } //end of the function RunThreadsOn

Here is the call graph for this function:

void RunThreadsOnIndividual int  workcnt,
qboolean  showpacifier,
void(*)(int)  func
 

Definition at line 97 of file l_threads.c.

References numthreads, RunThreadsOn(), ThreadSetDefault(), ThreadWorkerFunction(), and workfunction.

Referenced by CalcPassagePortalVis(), CalcPassageVis(), CalcPortalVis(), CalcVis(), GridAndVertexLighting(), LightWorld(), VL_DoForcedTraceLightSurfaces(), VL_LightWorld(), VL_Radiosity(), VS_DoForcedTraceLightSurfaces(), VS_LightWorld(), and VS_Radiosity().

00098 {
00099     if (numthreads == -1)
00100         ThreadSetDefault ();
00101     workfunction = func;
00102     RunThreadsOn (workcnt, showpacifier, ThreadWorkerFunction);
00103 } //end of the function RunThreadsOnIndividual

Here is the call graph for this function:

void ThreadLock void   ) 
 

Definition at line 1375 of file l_threads.c.

01376 {
01377 } //end of the function ThreadLock

void ThreadSetDefault void   ) 
 

Definition at line 1365 of file l_threads.c.

References numthreads.

01366 {
01367     numthreads = 1;
01368 } //end of the function ThreadSetDefault

void ThreadUnlock void   ) 
 

Definition at line 1384 of file l_threads.c.

01385 {
01386 } //end of the function ThreadUnlock


Variable Documentation

int numthreads
 

Definition at line 1356 of file l_threads.c.


Generated on Thu Aug 25 15:47:01 2005 for Quake III Arena by  doxygen 1.3.9.1