common: add start arg to RunThreadsOn to set initial progress

In case we are not starting work from 0, allow this to be set...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-02-07 20:51:04 +10:30
parent 853761d0d6
commit 3e20dae28e
5 changed files with 10 additions and 10 deletions

View File

@ -87,13 +87,13 @@ ThreadUnlock(void)
* =============
*/
void
RunThreadsOn(int workcnt, void *(func)(void *))
RunThreadsOn(int start, int workcnt, void *(func)(void *))
{
int i;
DWORD *threadid;
HANDLE *threadhandle;
dispatch = 0;
dispatch = start;
workcount = workcnt;
oldpercent = -1;
@ -175,7 +175,7 @@ ThreadUnlock(void)
* =============
*/
void
RunThreadsOn(int workcnt, void *(func)(void *))
RunThreadsOn(int start, int workcnt, void *(func)(void *))
{
pthread_t *threads;
pthread_mutexattr_t mattrib;
@ -183,7 +183,7 @@ RunThreadsOn(int workcnt, void *(func)(void *))
int status;
int i;
dispatch = 0;
dispatch = start;
workcount = workcnt;
oldpercent = -1;
@ -254,9 +254,9 @@ void ThreadUnlock(void) {}
* =============
*/
void
RunThreadsOn(int workcnt, void *(func)(void *))
RunThreadsOn(int start, int workcnt, void *(func)(void *))
{
dispatch = 0;
dispatch = start;
workcount = workcnt;
oldpercent = -1;

View File

@ -11,7 +11,7 @@ int GetDefaultThreads(void);
int GetMaxThreads(void); /* returns 0 if no limit specified */
int GetThreadWork(void);
int GetThreadWork_Locked__(void); /* caller must take care of locking */
void RunThreadsOn(int workcnt, void *(func)(void *));
void RunThreadsOn(int start, int workcnt, void *(func)(void *));
void ThreadLock(void);
void ThreadUnlock(void);

View File

@ -186,7 +186,7 @@ LightWorld(void)
lit_file_end = lit_filebase + 3 * (MAX_MAP_LIGHTING / 4);
}
RunThreadsOn(numfaces, LightThread);
RunThreadsOn(0, numfaces, LightThread);
lightdatasize = file_p - filebase;
logprint("lightdatasize: %i\n", lightdatasize);
}

View File

@ -489,5 +489,5 @@ BasePortalThread(void *dummy)
void
BasePortalVis(void)
{
RunThreadsOn(numportals * 2, BasePortalThread);
RunThreadsOn(0, numportals * 2, BasePortalThread);
}

View File

@ -616,7 +616,7 @@ CalcPortalVis(void)
return;
}
RunThreadsOn(numportals * 2, LeafThread);
RunThreadsOn(0, numportals * 2, LeafThread);
if (verbose) {
logprint("portalcheck: %i portaltest: %i portalpass: %i\n",