06-02-2007
Have a look here
Multiplexing with curses.
You need to treat the signals as another stream of input.
A common technique I use is to create a pipe and include it as one of the input sources in a select(...) loop, in the signal handler I write a single byte to the pipe (usually the signum) and in the event loop I read the pipe.
This avoids all the messyness of missing signals or interrupt system calls. All the signals end up queued in the pipe ready to be read following the select.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there a way that I can position cursor at say line 23, column 2?
Thank you in advance. (8 Replies)
Discussion started by: Latha Nair
8 Replies
2. UNIX for Dummies Questions & Answers
Hi there,
Is there a way to position the cursor at EOF in vi, I know from the man pages how to position the cursor at the end of a paragraph, but what about the EOF (End Of File).
Regards (6 Replies)
Discussion started by: JimJim
6 Replies
3. UNIX for Dummies Questions & Answers
Can anyone tell me how to ouput the current cursor coordinate? I have tried using tput sc and tput rc. However I want to know what the coordinate is.
Thanks. (1 Reply)
Discussion started by: bestbuyernc
1 Replies
4. UNIX for Dummies Questions & Answers
Is is possible to use the mouse in Terminal on OS X Leopard? I thought I read somewhere in the book that I have that it is, but I can't find it. I'd like to use it to click in one of the editors if I have to. (0 Replies)
Discussion started by: Straitsfan
0 Replies
5. Shell Programming and Scripting
Hi All,
please help me to know how to move the cursor to the desired position?
For example, in a shell script, I am displaying
echo "\t Enter your Name:"
please help me how to move cursor near the first word.
for example, if the output is as below
... (3 Replies)
Discussion started by: little_wonder
3 Replies
6. Shell Programming and Scripting
xx00102 1(SG):
xx00102 3(SG):
xx00115 lan900:
xx00115 lan901:
xx00116 1(SG):
xx00116 3(SG):
the boxes are echoed on the same line with one \t. Is there anyway to get all the boxes to line up? Or possibly is there a way to fix the position of something... (3 Replies)
Discussion started by: trimike
3 Replies
7. UNIX and Linux Applications
i have 2 cursors. i want to assign the value of first cursor(employee_id) to the where condition of cursor c2(please refer the bold statement).
how do i do if i want to assign the value of c1 to where condition of cursor c2?
declare
cursor c1 IS
select employee_id from employee
cursor c2... (1 Reply)
Discussion started by: vkca
1 Replies
8. UNIX for Dummies Questions & Answers
I have problem with this for last few days and I would really be grateful if you can help me :wall::wall::wall::wall::wall:
I have sets of files in one directory, and each of them have few lines
each one of these lines has 1 or more occurrence of words
Y =
I need to find the position of the... (10 Replies)
Discussion started by: A-V
10 Replies
9. Shell Programming and Scripting
I got these entries in a file
alias server.domain.com='ssh 192.168.1.1@user1 '
alias server1.domain.com='ssh user2 @192.168.1.1'
alias server1.domain.com='ssh user3@192.168.1.1'
In the above lines, last line is the correct format. The first is IP@username, has got a space after the... (9 Replies)
Discussion started by: anil510
9 Replies
LEARN ABOUT FREEBSD
sigwait
SIGWAIT(2) BSD System Calls Manual SIGWAIT(2)
NAME
sigwait -- select a set of signals
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <signal.h>
int
sigwait(const sigset_t * restrict set, int * restrict sig);
DESCRIPTION
The sigwait() system call selects a set of signals, specified by set. If none of the selected signals are pending, sigwait() waits until one
or more of the selected signals has been generated. Then sigwait() atomically clears one of the selected signals from the set of pending
signals (for the process or for the current thread) and sets the location pointed to by sig to the signal number that was cleared.
The signals specified by set should be blocked at the time of the call to sigwait().
If more than one thread is using sigwait() to wait for the same signal, no more than one of these threads will return from sigwait() with the
signal number. If more than a single thread is blocked in sigwait() for a signal when that signal is generated for the process, it is
unspecified which of the waiting threads returns from sigwait(). If the signal is generated for a specific thread, as by pthread_kill(),
only that thread will return.
Should any of the multiple pending signals in the range SIGRTMIN to SIGRTMAX be selected, it will be the lowest numbered one. The selection
order between realtime and non-realtime signals, or between multiple pending non-realtime signals, is unspecified.
IMPLEMENTATION NOTES
The sigwait() function is implemented as a wrapper around the __sys_sigwait() system call, which retries the call on EINTR error.
RETURN VALUES
If successful, sigwait() returns 0 and sets the location pointed to by sig to the cleared signal number. Otherwise, an error number is
returned.
ERRORS
The sigwait() system call will fail if:
[EINVAL] The set argument specifies one or more invalid signal numbers.
SEE ALSO
sigaction(2), sigpending(2), sigqueue(2), sigsuspend(2), sigtimedwait(2), sigwaitinfo(2), pause(3), pthread_sigmask(3)
STANDARDS
The sigwait() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
BSD
September 6, 2013 BSD