Lines Matching +full:x +full:- +full:rc
29 # Threaded producer-consumer test.
37 mycc -o pthread2 -Wall -Wextra -O2 -g pthread2.c -lpthread || exit 1
38 rm -f pthread2.c /tmp/pthread2.core
40 log=/tmp/pthread2.`date '+%Y%m%d-%H%M'`
42 [ $i -eq 1 ] && echo "# `uname -v`"
43 time sh -c '
50 rm -f /tmp/pthread2
52 if [ -n "$bench" ]; then
53 pair=`ls /tmp/pthread2* | egrep "pthread2\.[0-9]{8}-" | sort |
54 tail -2 | tr '\n' ' '`
55 ministat -w 72 $pair
57 rm -f $log
61 [ -r /tmp/pthread2.core ] && echo FAIL
65 * Threaded producer-consumer test.
90 #define LOCK(x) plock(&x.mtx)
91 #define UNLOCK(x) punlock(&x.mtx)
92 #define SIGNAL(x) psig(&x.wait)
93 #define WAIT(x) pwait(&x.wait, &x.mtx)
133 int rc;
135 if ((rc = pthread_mutex_lock(l)) != 0)
136 errc(1, rc, "pthread_mutex_lock");
142 int rc;
144 if ((rc = pthread_mutex_unlock(l)) != 0)
145 errc(1, rc, "pthread_mutex_unlock");
151 int rc;
153 if ((rc = pthread_cond_signal(c)) != 0)
154 errc(1, rc, "pthread_cond_signal");
160 int rc;
162 if ((rc = pthread_cond_wait(c, l)) != 0)
163 errc(1, rc, "pthread_cond_wait");
178 asprintf(&file->name, "%s/filename_too-long:%d", dirname1, i);
184 if (ncreate - nrename > MAXQ)
208 filename = strrchr(file->name, '/');
211 free(file->name);
212 file->name = newname;
239 free(file->name);
249 int rc;
260 if ((rc = pthread_mutex_init(&newfiles.mtx, NULL)) != 0)
261 errc(1, rc, "pthread_mutex_init()");
262 if ((rc = pthread_cond_init(&newfiles.wait, NULL)) != 0)
263 errc(1, rc, "pthread_cond_init()");
264 if ((rc = pthread_mutex_init(&renamedfiles.mtx, NULL)) != 0)
265 errc(1, rc, "pthread_mutex_init()");
266 if ((rc = pthread_cond_init(&renamedfiles.wait, NULL)) != 0)
267 errc(1, rc, "pthread_cond_init()");
272 if ((rc = pthread_create(&tid[0], NULL, loop_create, NULL)) != 0)
273 errc(1, rc, "pthread_create()");
274 if ((rc = pthread_create(&tid[1], NULL, loop_rename, NULL)) != 0)
275 errc(1, rc, "pthread_create()");
276 if ((rc = pthread_create(&tid[2], NULL, loop_unlink, NULL)) != 0)
277 errc(1, rc, "pthread_create()");
280 if ((rc = pthread_join(tid[i], NULL)) != 0)
281 errc(1, rc, "pthread_join(%d)", i);
284 if ((rc = pthread_mutex_destroy(&newfiles.mtx)) != 0)
285 errc(1, rc, "pthread_mutex_destroy(newfiles)");
286 if ((rc = pthread_cond_destroy(&newfiles.wait)) != 0)
287 errc(1, rc, "pthread_cond_destroy(newfiles)");
288 if ((rc = pthread_mutex_destroy(&renamedfiles.mtx)) != 0)
289 errc(1, rc, "pthread_mutex_destroy(renamedfiles)");
290 if ((rc = pthread_cond_destroy(&renamedfiles.wait)) != 0)
291 errc(1, rc, "pthread_cond_destroy(renamedfiles)");