Implementing A "Future" (Cont.) if (pthread_mutex_lock(&f->mutex) != 0) goto int_future_set_value_mutex_fail; /* set the value, and notify the waiter (if any). */ f->value = value; f->value_is_set = 1; pthread_cond_signal(&f->cond); pthread_mutex_unlock(&f->mutex); int_future_set_value_mutex_fail: int_future_set_value_ret: return rc; }