I write a test file for POSIX Semaphore!!
I have see the semaphore manual page in Linux (use man sem_init) .
But the file can't be complied. It appears some errors.
So, I am not sure whether Linux implement POSIX semaphore??
Thanks!
===========================================
#include <stdio.h>
#include <semaphore.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
sem_t sem;
int i;
if( sem_init(&sem,1,1)==-1)
perror("sem_init");
fork();
fork();
fork();
fork();
fork();
fork();
if(sem_wait(&sem)==-1)
{
perror("Semaphore invalid");
exit(1);
}
while(i=0;i<20;i++)
printf("%d ",i++);
printf("\n");
if(sem_post(&sem)==-1)
{
perror("Semaphore done");
exit(1);
}
exit(0);*/
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:14 EST