#include "l_cmd.h"
#include "l_threads.h"
#include "l_log.h"
#include "l_mem.h"
Include dependency graph for l_threads.c:

Go to the source code of this file.
Defines | |
| #define | MAX_THREADS 64 |
Functions | |
| void | AddThread (void(*func)(int)) |
| int | GetNumThreads (void) |
| int | GetThreadWork (void) |
| void | RemoveThread (int threadid) |
| void | RunThreadsOn (int workcnt, qboolean showpacifier, void(*func)(int)) |
| void | RunThreadsOnIndividual (int workcnt, qboolean showpacifier, void(*func)(int)) |
| void | ThreadLock (void) |
| void | ThreadSemaphoreIncrease (int count) |
| void | ThreadSemaphoreWait (void) |
| void | ThreadSetDefault (void) |
| void | ThreadSetupLock (void) |
| void | ThreadSetupSemaphore (void) |
| void | ThreadShutdownLock (void) |
| void | ThreadShutdownSemaphore (void) |
| void | ThreadUnlock (void) |
| void | ThreadWorkerFunction (int threadnum) |
| void | WaitForAllThreadsFinished (void) |
Variables | |
| int | currentnumthreads = 0 |
| int | dispatch |
| int | numthreads = 1 |
| int | oldf |
| qboolean | pacifier |
| qboolean | threaded |
| int | workcount |
| void(* | workfunction )(int) |
|
|
Definition at line 28 of file l_threads.c. |
|
|
Definition at line 1474 of file l_threads.c. References currentnumthreads, and func(). Referenced by BuildTree(). 01475 {
01476 if (currentnumthreads >= numthreads) return;
01477 currentnumthreads++;
01478 func(-1);
01479 currentnumthreads--;
01480 } //end of the function AddThread
|
Here is the call graph for this function:

|
|
Definition at line 1505 of file l_threads.c. Referenced by NextNodeFromList(). 01506 {
01507 return currentnumthreads;
01508 } //end of the function GetNumThreads
|
|
|
Definition at line 45 of file l_threads.c. Referenced by ThreadWorkerFunction(). 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
|
|
|
Definition at line 1487 of file l_threads.c. Referenced by BuildTreeThread(). 01488 {
01489 } //end of the function RemoveThread
|
|
||||||||||||||||
|
Definition at line 1448 of file l_threads.c. 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
|
|
||||||||||||||||
|
Definition at line 97 of file l_threads.c. 00098 {
00099 if (numthreads == -1)
00100 ThreadSetDefault ();
00101 workfunction = func;
00102 RunThreadsOn (workcnt, showpacifier, ThreadWorkerFunction);
00103 } //end of the function RunThreadsOnIndividual
|
|
|
Definition at line 1375 of file l_threads.c. Referenced by AddNodeToQueue(), AddNodeToStack(), GetThreadWork(), IncreaseNodeCounter(), NextNodeFromList(), and NodeListSize(). 01376 {
01377 } //end of the function ThreadLock
|
|
|
Definition at line 1439 of file l_threads.c. Referenced by AddNodeToQueue(), AddNodeToStack(), and NextNodeFromList(). 01440 {
01441 } //end of the function ThreadSemaphoreIncrease
|
|
|
Definition at line 1430 of file l_threads.c. Referenced by NextNodeFromList(). 01431 {
01432 } //end of the function ThreadSemaphoreWait
|
|
|
Definition at line 1365 of file l_threads.c. Referenced by AAS_Create(), LightMain(), main(), RunThreadsOnIndividual(), VisMain(), VLightMain(), and VSoundMain(). 01366 {
01367 numthreads = 1;
01368 } //end of the function ThreadSetDefault
|
|
|
Definition at line 1393 of file l_threads.c. References Log_Print(). Referenced by BuildTree(). 01394 {
01395 Log_Print("no multi-threading\n");
01396 } //end of the function ThreadInitLock
|
Here is the call graph for this function:

|
|
Definition at line 1412 of file l_threads.c. Referenced by BuildTree(). 01413 {
01414 } //end of the function ThreadSetupSemaphore
|
|
|
Definition at line 1403 of file l_threads.c. Referenced by BuildTree(). 01404 {
01405 } //end of the function ThreadShutdownLock
|
|
|
Definition at line 1421 of file l_threads.c. Referenced by BuildTree(). 01422 {
01423 } //end of the function ThreadShutdownSemaphore
|
|
|
Definition at line 1384 of file l_threads.c. Referenced by AddNodeToQueue(), AddNodeToStack(), GetThreadWork(), IncreaseNodeCounter(), NextNodeFromList(), and NodeListSize(). 01385 {
01386 } //end of the function ThreadUnlock
|
|
|
Definition at line 78 of file l_threads.c. References GetThreadWork(), and workfunction. Referenced by RunThreadsOnIndividual(). 00079 {
00080 int work;
00081
00082 while(1)
00083 {
00084 work = GetThreadWork ();
00085 if (work == -1)
00086 break;
00087 //printf ("thread %i, work %i\n", threadnum, work);
00088 workfunction(work);
00089 } //end while
00090 } //end of the function ThreadWorkerFunction
|
Here is the call graph for this function:

|
|
Definition at line 1496 of file l_threads.c. Referenced by BuildTree(). 01497 {
01498 } //end of the function WaitForAllThreadsFinished
|
|
|
Definition at line 1357 of file l_threads.c. Referenced by AddThread(). |
|
|
Definition at line 32 of file l_threads.c. Referenced by GetThreadWork(), and RunThreadsOn(). |
|
|
Definition at line 1356 of file l_threads.c. |
|
|
Definition at line 34 of file l_threads.c. Referenced by GetThreadWork(), and RunThreadsOn(). |
|
|
Definition at line 35 of file l_threads.c. Referenced by RunThreadsOn(). |
|
|
Definition at line 36 of file l_threads.c. |
|
|
Definition at line 33 of file l_threads.c. Referenced by RunThreadsOn(). |
|
|
Definition at line 37 of file l_threads.c. Referenced by RunThreadsOnIndividual(). |
1.3.9.1