Beispiel #1
0
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;
}
Beispiel #2
0
	void Wait(unsigned n = 1)
	{
		while(n--) _decr();
	}
Beispiel #3
0
void Semaphore::Wait(unsigned n)
{
	while(n--) _decr();
}
Beispiel #4
0
void Semaphore::Wait(std::size_t n)
{
    while(n--) _decr();
}