we developed a set of system V semphore interface for our application, in general, all of them work normal, seldom cause the deadlock. Here are some important sem_wait and sem_post interface, pls point some suggestion to fixed the deadlock problem:
Last edited by Frank2004; 02-03-2008 at 11:06 PM..
how can I lock my keyboard while I'm away from the computer without using lock command. What other commands gives me the option to lock keyboard device?
thanks (7 Replies)
Hello,there
here is my code about semphore, when calling it in the program,sometimes result in the deadlock of semphore, but I can not find it, anyone can point some bugs and give some suggestion?
#define BIGCOUNT 888 // initial value of process counter
#define SEM_POST_LIMIT 3 ... (0 Replies)
Hi all,
I have a directory where some process is keeping incremental/new log files. I need to code a program which will periodically poll this directory and if it founds a new file arrived then copy that new file to some other specific directory.
We are OK with this polling approach. I just... (3 Replies)
Hi,
I have some problem with following command.
$path='pwd'.”/pack”;
When I check the value in the variable path , it give the following output
/tmp/new /pack
The pwd will be /tmp/new
Now the problem is the spaces is added between pwd and the appended path.
I need the output like... (5 Replies)
Hello,
this is solaris 10 on SF v440,
I know below errors might go away if I put a new PS or put the original one back in socket but is there any other way to stop these errors from appearing in /var/adm/messages ? I do not want to put the failed PS1 in socket neither do we want to spend on... (5 Replies)
Hello all,
If anyone has time, I have a few questions:
How do I do the following in Linux. We are using Red Hat and Oracle Enterprise Linux, which is based on Red Hat too.
1. How to lock the account after a few (like 3) invalid password attempts?
2. How do you lock a screen after 30... (1 Reply)
Hi,
I am having multiple echo statements to print output
echo "$VAr"
echo "$lenght"
echo "$sum"
I get the output as
12
24
36
I need the output to be 12 24 36.
How do i arrive at this.
Thanks in advance (4 Replies)
Hi all,
I have to test some user priviliges. The goal is to be sure that an unauthorized user can't restart some modules (ssh, mysql etc...).
I'm trying to automate it with a shell script but in same cases I got the syslog broadcast message.
Is there any way to simply get a return code... (3 Replies)
Hi I have a script which runs the isql command and takes the output in a xls file.
Is there a way to trim the spaces(leading and trailing) from all the values in the column of the xls sheet? (6 Replies)
Discussion started by: Sharma331
6 Replies
LEARN ABOUT OSX
sem_trywait
SEM_WAIT(2) BSD System Calls Manual SEM_WAIT(2)NAME
sem_trywait, sem_wait -- lock a semaphore
SYNOPSIS
#include <semaphore.h>
int
sem_trywait(sem_t *sem);
int
sem_wait(sem_t *sem);
DESCRIPTION
The semaphore referenced by sem is locked. When calling sem_wait(), if the semaphore's value is zero, the calling thread will block until
the lock is acquired or until the call is interrupted by a signal. Alternatively, the sem_trywait() function will fail if the semaphore is
already locked, rather than blocking on the semaphore.
If successful (the lock was acquired), sem_wait() and sem_trywait() will return 0. Otherwise, -1 is returned and errno is set, and the state
of the semaphore is unchanged.
ERRORS
sem_wait() and sem_trywait() succeed unless:
[EAGAIN] The semaphore is already locked.
[EDEADLK] A deadlock was detected.
[EINTR] The call was interrupted by a signal.
[EINVAL] sem is not a valid semaphore descriptor.
NOTES
Applications may encounter a priority inversion while using semaphores. When a thread is waiting on a semaphore which is about to be posted
by a lower-priority thread and the lower-priority thread is preempted by another thread (of medium priority), a priority inversion has
occured, and the higher-priority thread will be blocked for an unlimited time period. Programmers using the realtime functionality of the
system should take care to avoid priority inversions.
SEE ALSO sem_open(2), sem_post(2), semctl(2), semget(2), semop(2)HISTORY
sem_wait() and sem_trywait() are specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995).
Darwin June 8, 2000 Darwin