1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
$NetBSD: patch-ab,v 1.1.1.1 2005/03/26 17:05:03 minskim Exp $
--- lucy.c.orig Mon Apr 21 15:08:41 2003
+++ lucy.c
@@ -147,7 +147,7 @@ Seq *ptr;
/* thread related variables */
pthread_mutex_t job_lock, acc_lock;
pthread_cond_t job_waiting, job_returning, job_done;
-int thread_count, job_count, job_close, shutdown, *jobs, job_todo, job_pool;
+int thread_count, job_count, job_close, shut, *jobs, job_todo, job_pool;
pthread_t *threads;
void (*work)();
@@ -172,9 +172,9 @@ void *worker(arg)
int id=(int)arg;
pthread_mutex_lock(&job_lock);
while (1) {
- while (job_todo<0 && !shutdown)
+ while (job_todo<0 && !shut)
pthread_cond_wait(&job_waiting, &job_lock);
- if (shutdown) {
+ if (shut) {
pthread_mutex_unlock(&job_lock);
pthread_exit(NULL);
}
@@ -515,7 +515,7 @@ char *argv[];
/******************************************************/
threads=(pthread_t*)malloc(sizeof(pthread_t)*thread_count);
jobs=(int*)malloc(sizeof(int)*(thread_count+1));
- job_count=job_close=shutdown=0; job_todo=job_pool=-1; id=thread_count;
+ job_count=job_close=shut=0; job_todo=job_pool=-1; id=thread_count;
if (pthread_mutex_init(&job_lock, NULL))
giveup("can't initialize thread mutex job_lock");
@@ -1018,7 +1018,7 @@ char *argv[];
/******************************************************/
/* Phase 0.3: terminate all computing threads */
/******************************************************/
- shutdown=1;
+ shut=1;
pthread_cond_broadcast(&job_waiting);
for (i=0; i<thread_count; i++)
pthread_join(threads[i], NULL);
|