int main(int argc, char* argv[]) { limit = 60; if (argc > 1) limit = atoi(argv[1]); printf("Counting demo starting with pid %d\n", (int)getpid()); for (count = 0; count < limit;) printf("Count = %d\n", _incr()); for (count >= limit; count > 0;) printf("Count = %d\n", _decr()); return 0; }
void Signal(unsigned n = 1) { _incr(n); }
int CommandProc::proc_decr(const Link &link, const Request &req, Response *resp){ return _incr(ssdb, req, resp, -1); }
int proc_decr(NetworkServer *net, Link *link, const Request &req, Response *resp){ SSDBServer *serv = (SSDBServer *)net->data; CHECK_KEY_RANGE(1); return _incr(serv, req, resp, -1); }
void Semaphore::Signal(unsigned n) { _incr(n); }
static int proc_decr(Server *serv, Link *link, const Request &req, Response *resp){ return _incr(serv->ssdb, req, resp, -1); }
void Semaphore::Signal(std::size_t n) { _incr(n); }