Lines Matching refs:phase

71 static unsigned volatile phase;
88 trace("thread %u in phase %u\n", *number, i);
96 t_error("thread %u is last in phase %u, signalling main failed: %s\n", *number, i, errorstring(ret));
98 while (i == phase) {
99 tell("thread %u in phase %u (%u), waiting\n", *number, i, phase);
102 trace("thread %u in phase %u (%u), finished, %s\n", *number, i, phase, errorstring(ret));
104 t_error("thread %u in phase %u (%u) finished waiting: %s\n", *number, i, phase, errorstring(ret));
109 trace("thread %u in phase %u (%u), has unlocked mutex: %s\n", *number, i, phase, errorstring(ret));
111 t_error("thread %u in phase %u (%u), failed to unlock: %s\n", *number, i, phase, errorstring(ret));
133 while (phase < phases) {
134 while (inside[phase] < threads) {
135 trace("main seeing %u threads in phase %u, waiting\n", inside[phase], phase);
137 int ret = condition_timedwait(&cond_main, &mut[phase], &ts);
138 tell("main seeing %u threads in phase %u, %s\n", inside[phase], phase, errorstring(ret));
140 t_error("main thread in phase %u (%u threads inside), finished waiting: %s\n", phase, inside[phase], errorstring(ret));
145 mutex, if any, such that nobody can enter the next phase
147 if (phase < phases-1)
148 mutex_lock(&mut[phase+1]);
149 /* Now signal all clients, update the phase count and release the
152 trace("main has broadcast to %u: %s\n", phase, errorstring(ret));
154 t_error("main broadcast in phase %u failed: %s\n", phase, errorstring(ret));
155 ++phase;
156 ret = mutex_unlock(&mut[phase-1]);
157 trace("main has unlocked mutex %u: %s\n", phase-1, errorstring(ret));
159 t_error("main failed to unlock mutex %u: %s\n", phase-1, errorstring(ret));