Sponsored Content
Operating Systems Linux does sending a signal cause task switching Post 302312360 by Neo on Friday 1st of May 2009 04:04:24 AM
Old 05-01-2009
I do not think you cannot depend on process 1 to wait for process 2. The signal is asynchronous. Your results are dependent on an assumed timing that the signal will be received and processed before the sending process executes the next line.

To be atomic, you need to use a semaphore, for example.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sending a signal from Unix to Windows

Hi all, I was wondering if anyone could help me here. I have got a Unix Server (Solaris 8) which we access over the network from a Windows NT machine using Exceed. The Unix box has Samba installed so it is very easy to send a signal from Windows to UNIX by simply creating a dummy file which... (3 Replies)
Discussion started by: robbiegregg
3 Replies

2. Shell Programming and Scripting

su (switching to other user)

Hi, what is the use of the double quotes and !! in the following code segment: su - user1 << ""!! > /dev/null 2>&1 echo "welcome user1" EOF !! also what is the difference between below: su - user1 << ""!! > /dev/null 2>&1 and su - $USER << ""!!!> /dev/null 2>&1. Note: $USER =... (2 Replies)
Discussion started by: bjagadeesh
2 Replies

3. Shell Programming and Scripting

comment and Uncomment single task out of multiple task

I have a file contains TASK gsnmpproxy { CommandLine = $SMCHOME/bin/gsnmpProxy.exe } TASK gsnmpdbgui { CommandLine = $SMCHOME/bin/gsnmpdbgui.exe I would like to comment and than uncomment specific task eg TASK gsnmpproxy Pls suggest how to do in shell script (9 Replies)
Discussion started by: madhusmita
9 Replies

4. Shell Programming and Scripting

Switching between two users

Can any one tell me : How we can switch between two users without prompting for the password. (In the SHELL SCRIPT can we fetch the USERID and PASSWORD from a specified file, without using SUDO command)? (2 Replies)
Discussion started by: deepusunil
2 Replies

5. Shell Programming and Scripting

Parse an XML task list to create each task.xml file

I have an task definition listing xml file that contains a list of tasks such as <TASKLIST <TASK definition="Completion date" id="Taskname1" Some other <CODE name="Code12" <Parameter pname="Dog" input="5.6" units="feet" etc /Parameter> <Parameter... (3 Replies)
Discussion started by: MissI
3 Replies

6. UNIX for Dummies Questions & Answers

Sending signal from child to parent process!

Hi All, I facing a problem in handling signals between parent process communication. I am trying to send a signal(SIGINT) from child to parent. I am using kill function to do so and I am trying to read the signal using sigaction(). But the program is ending abruptly and I am not able to figure out... (4 Replies)
Discussion started by: vkn_1985
4 Replies

7. OS X (Apple)

vt switching

greetings, i hope this hasn't been covered previously. has anyone heard of a .kext or daemon that would allow linux or (open)solaris-like vt switching? googling didn't help much.. i know os x allows a '>console' login from loginwindow.app, but i'm mainly interested in this because there are... (0 Replies)
Discussion started by: bamdad
0 Replies

8. Solaris

The switching in the different AP's

HI, I am using the windows 2003 server R2 in there we are using the putty as to access the different AP's now from the primary AP i want to login to several different AP's using a script what the script will do is :- input a text file in which list of different ap's and the corresponding... (0 Replies)
Discussion started by: amiglani
0 Replies

9. UNIX for Dummies Questions & Answers

Help with switching the users

Hello. I am using a instance of Centos 5.5, I currently have two users root and zetaris, but when I try to switch the user from root su zetaris or su - zetaris the next command line shows bash-3.2$ and stops there. Further there is no response from instance. Please help me with this problem. I... (3 Replies)
Discussion started by: nnani
3 Replies

10. Programming

Switching over to C++

Hi, We've been using a perl script to extract datas from several logs to generate a report. I've been asked to rewrite the code in C++. I want to know if it is wise to have a code in C++ and will it be more faster than Perl? (23 Replies)
Discussion started by: Ribosome
23 Replies
msem_lock(2)							System Calls Manual						      msem_lock(2)

NAME
msem_lock() - lock a semaphore SYNOPSIS
DESCRIPTION
attempts to lock a binary semaphore. sem points to an structure which specifies the semaphore to be locked. If the semaphore is not currently locked, it becomes locked and the function returns successfully. If the semaphore is currently locked, and condition is then the function returns with an error. If the semaphore is currently locked and condition is zero, the function does not return until either the calling process is able to successfully lock the semaphore, or an error condition occurs. All calls to and by multiple processes sharing a common structure behave as if the calls were serialized. If the structure contains any value not resulting from a call to followed by a (possibly empty) sequence of calls to and the results are undefined. The address of an uniquely identifies the semaphore. If the structure contains any value copied from an structure at a differ- ent address, the result is undefined. IMPLEMENTATION NOTES
If blocked on a locked semaphore, suspends the calling process at a priority such that the process can be interrupted by a signal. The system attempts to ignore or recover from invalid values written to the structure, but this is not guaranteed for all cases. successfully acquires a semaphore that is locked by a process that has exited. RETURN VALUE
returns one of the following values: Success. Failure. is set to indicate the error. ERRORS
sets to one of the following values if the corresponding condition is encountered. was specified and the semaphore was already locked. sem points to an structure that has been removed, or condition is invalid. was interrupted by a signal that was caught. The semaphore is currently locked, condition is zero, and waiting to lock the semaphore would create a deadlock. sem is not a properly aligned address or is otherwise an invalid pointer. AUTHOR
was developed by HP and OSF. SEE ALSO
msem_init(2), msem_remove(2), msem_unlock(2), mman(5). STANDARDS CONFORMANCE
msem_lock(2)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy