In the last episode (Feb 06), Eric Jacoboni said:
> Here's a sample code:
>
> #include
...
>dis_ping = sem_open("/ping.sem", O_CREAT, 0777, 1);
...
>
> On FBSD 5.2, gcc first complains it doesn't know about O_CREAT...
> That's not what the sem_open() manpage claims but, ok, let's include
> .
Hi,
Here's a sample code:
#include
#include
int main(void) {
sem_t *dis_ping, *dis_pong;
dis_ping = sem_open("/ping.sem", O_CREAT, 0777, 1);
dis_pong = sem_open("/pong.sem", O_CREAT, 0777, 0);
for(;;) {
sem_wait(dis_ping);
puts("Ping...");
sem_post(dis_pong);
}