SEM_DESTROY(3) BSD Library Functions Manual SEM_DESTROY(3)NAME
sem_destroy -- destroy an unnamed semaphore
LIBRARY
POSIX Real-time Library (librt, -lrt)
SYNOPSIS
#include <semaphore.h>
int
sem_destroy(sem_t *sem);
DESCRIPTION
The sem_destroy() function destroys the unnamed semaphore pointed to by sem. After a successful call to sem_destroy(), sem is unusable until
re-initialized by another call to sem_init().
RETURN VALUES
The sem_destroy() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to
indicate the error.
ERRORS
sem_destroy() will fail if:
[EBUSY] There are currently threads blocked on the semaphore that sem points to.
[EINVAL] sem points to an invalid semaphore.
SEE ALSO sem_init(3)STANDARDS
sem_destroy() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
POSIX does not define the behavior of sem_destroy() if called while there are threads blocked on sem, but this implementation is guaranteed
to return -1 and set errno to EBUSY if there are threads blocked on sem.
BSD January 22, 2003 BSD
Check Out this Related Man Page
SEM_DESTROY(3) BSD Library Functions Manual SEM_DESTROY(3)NAME
sem_destroy -- destroy an unnamed semaphore
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <semaphore.h>
int
sem_destroy(sem_t *sem);
DESCRIPTION
The sem_destroy() function destroys the unnamed semaphore pointed to by sem. After a successful call to sem_destroy(), sem is unusable until
re-initialized by another call to sem_init(3).
RETURN VALUES
The sem_destroy() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to
indicate the error.
ERRORS
The sem_destroy() function will fail if:
[EINVAL] The sem argument points to an invalid semaphore.
[EBUSY] There are currently threads blocked on the semaphore that sem points to.
SEE ALSO sem_init(3)STANDARDS
The sem_destroy() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
POSIX does not define the behavior of sem_destroy() if called while there are threads blocked on sem, but this implementation is guaranteed
to return -1 and set errno to EBUSY if there are threads blocked on sem.
BSD February 15, 2000 BSD
Hi there,
Could someone please confirm which POSIX semaphore routines should be used for a multiprocess (and not multithreaded) environment?
sys/sem.h definitely works. but the routines, semget, semctl, semop are pretty unwieldy. So, I am looking for an easier way out.
From the man pages... (2 Replies)
Apparently there are three similar features in the linux API. Can someone explain the difference between the data structures that are initialized by these functions:
(1) pthread_mutex_init
(2) sem_init
(3) sem_get
Thanks,
Siegfried (5 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a C program that accepts 3 parameters. Each parameter indicates the quantity of product to be
produced.... (1 Reply)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Write a C program that accepts 3 parameters. Each parameter indicates the quantity of product to be
produced.... (0 Replies)
I have one process which creates semaphore with permission 600. Then at some part of the code I have line where this semaphore will be removed. Problem I have is that other processes in my program also try to execute this line of code. Of course since they dont have permission they wont be able to... (1 Reply)
i'm using smitty to create user...what happen is it prompt me "failed" with error
3004-703 Check "/etc/security/login.cfg" file.
3004-691 Error changing "shell".
3004-703 Check "/usr/lib/security/mkuser.default" file.
3004-721 Could not create user.
3004-703 Check... (13 Replies)
Hi Experts,
I have a programming assignment that asks us to implement a pipegrep function. it basically has 5 stages and each stage has a thread and buffers are used between stages.
am currently implementing stage 1 . In stage 1 am suppose to read directory and store the filenames in buffer1... (15 Replies)
I'm newbie in UNIX programming, I have a problem with signals. I'm writing multithread program, where threads can die at any moment. When thread dies it generates signal SIGUSR1 to main thread and then thread dies. Main thread gets a signal and waits for thread dead.
I wrote program like this:
... (5 Replies)