-#ifdef THREAD_JOIN_IMPLEMENTED
- thread_join (t[i].thread);
-#else
- sema_down (&t[i].done);
-#endif
+ struct sleep_thread *t;
+ int new_prod;
+
+ ASSERT (*op >= 0 && *op < thread_cnt);
+ t = threads + *op;
+
+ new_prod = ++t->iterations * t->duration;
+
+ printf ("thread %d: duration=%d, iteration=%d, product=%d\n",
+ t->id, t->duration, t->iterations, new_prod);
+
+ if (new_prod >= product)
+ product = new_prod;
+ else
+ printf ("FAIL: thread %d woke up out of order (%d > %d)!\n",
+ t->id, product, new_prod);