ProxyRequestContext::~ProxyRequestContext() { if (recording_) { recordingState_.~unique_ptr<RecordingState>(); return; } assert(replied_); if (reqComplete_) { fiber_local::runWithoutLocals([this]() { reqComplete_(*this); }); } if (processing_) { --proxy_.numRequestsProcessing_; stat_decr(proxy_.stats, proxy_reqs_processing_stat, 1); proxy_.pump(); } if (requester_) { if (requester_->maxOutstanding_ != 0) { counting_sem_post(&requester_->outstandingReqsSem_, 1); } } stat_decr_safe(proxy_.stats, proxy_request_num_outstanding_stat); }
void produce(int id, int Y) { for (int i = 0; i < Y; ++i) { counting_sem_post(&sem, 1); } printf("producer %d done\n", id); }