Lines Matching +full:x +full:- +full:rc

36 mycc -o pthread3 -Wall -Wextra -O2 -g -gdwarf-2 pthread3.c -lpthread || exit 1
37 rm -f pthread3.c
47 [ $e -ne 0 ] && s=$e
50 rm -f /tmp/pthread3
55 * Threaded producer-consumer test.
81 #define LOCK(x) plock(&x.mtx)
82 #define UNLOCK(x) punlock(&x.mtx)
83 #define SIGNAL(x) psig(&x.wait)
84 #define WAIT(x) pwait(&x.wait, &x.mtx)
121 int rc;
123 if ((rc = pthread_mutex_lock(l)) != 0)
124 errc(1, rc, "pthread_mutex_lock");
130 int rc;
132 if ((rc = pthread_mutex_unlock(l)) != 0)
133 errc(1, rc, "pthread_mutex_unlock");
139 int rc;
141 if ((rc = pthread_cond_signal(c)) != 0)
142 errc(1, rc, "pthread_cond_signal");
148 int rc;
150 if ((rc = pthread_cond_wait(c, l)) != 0)
151 errc(1, rc, "pthread_cond_wait");
166 asprintf(&file->name, "%s/filename_too-long:%d", dirname1, i);
197 filename = strrchr(file->name, '/');
200 free(file->name);
201 file->name = newname;
228 free(file->name);
242 int rc;
253 if ((rc = pthread_mutex_init(&newfiles.mtx, NULL)) != 0)
254 errc(1, rc, "pthread_mutex_init()");
255 if ((rc = pthread_cond_init(&newfiles.wait, NULL)) != 0)
256 errc(1, rc, "pthread_cond_init()");
257 if ((rc = pthread_mutex_init(&renamedfiles.mtx, NULL)) != 0)
258 errc(1, rc, "pthread_mutex_init()");
259 if ((rc = pthread_cond_init(&renamedfiles.wait, NULL)) != 0)
260 errc(1, rc, "pthread_cond_init()");
265 if ((rc = pthread_create(&tid[0], NULL, loop_create, NULL)) != 0)
266 errc(1, rc, "pthread_create()");
267 if ((rc = pthread_create(&tid[1], NULL, loop_rename, NULL)) != 0)
268 errc(1, rc, "pthread_create()");
269 if ((rc = pthread_create(&tid[2], NULL, loop_unlink, NULL)) != 0)
270 errc(1, rc, "pthread_create()");
273 if ((rc = pthread_join(tid[i], NULL)) != 0)
274 errc(1, rc, "pthread_join(%d)", i);
277 if ((rc = pthread_mutex_destroy(&newfiles.mtx)) != 0)
278 errc(1, rc, "pthread_mutex_destroy(newfiles)");
279 if ((rc = pthread_cond_destroy(&newfiles.wait)) != 0)
280 errc(1, rc, "pthread_cond_destroy(newfiles)");
281 if ((rc = pthread_mutex_destroy(&renamedfiles.mtx)) != 0)
282 errc(1, rc, "pthread_mutex_destroy(renamedfiles)");
283 if ((rc = pthread_cond_destroy(&renamedfiles.wait)) != 0)
284 errc(1, rc, "pthread_cond_destroy(renamedfiles)");