At any rate, pause will work, I've seen people do:
And then, as mentioned, pthread_kill can wake it provided the thread hasn't blocked the signal.
Interesting. That'll take some careful use of signals though, whether a system call returns with SIGINT when interrupted is optional, and not all systems have the same default.
Quote:
Originally Posted by DreamWarrior
sleep doesn't send SIGALRM.
Maybe not on your system, but some sure do.
Last edited by Corona688; 12-16-2011 at 05:38 PM..
Im old to Unix but new to scripting
I have a MacBook running osx that I want to use as an nfs client. The server will be a linux box with a wake on lan card. Here's the idea. Run a cron command on the mac every minute that checks if I am on my home wireless network (the linux box is wired to... (0 Replies)
m old to Unix but new to scripting
I have a MacBook running osx that I want to use as an nfs client. The server will be a linux box with a wake on lan card. Here's the idea. Run a cron command on the mac every minute that checks if I am on my home wireless network (the linux box is wired to... (6 Replies)
I have two threads: one maintains a thread-safe message queue (handle this queue at the beginning of every loop) and deals with tcp connections, the other one posts message to the former one. the problem is, while the former one was blocking at epoll_wait, it's not sure that how long until the... (0 Replies)
Hello, I'm searching for a proper way to let the kernel space ISR(implemented in a kernel module) wake up a user space thread on a hardware interrupt.
Except for sending a real-time signal, is it possible to use a semaphore?
I've searched it on google, but it seems impossible to share a... (0 Replies)
This is a very crude attempt in Bash at something that I needed but didn't seem to find in the 'sleep' command. However, I would like to be able to do it without the need for the temp file. Please go easy on me if this is already possible in some other way:
How many times have you used the... (5 Replies)
Hi all,
Is it possible to do the following in Linux (kernel 2.6.x):
- A user-space thread goes to "sleep". Using any call/mechanism
- On a hardware generated interrupt, the Interrupt handler (ISR) "wakes" the sleeping user-thread.
I have seen wait_event() and wake_up() but it appears... (1 Reply)
I'm a OS X user (MacBook Pro, OS X Lion) and I need it to wake up on Mondays, Wednesdays, Thursdays and Saturdays at 9:00 AM
on the rest of the days of the week at 7:00
I issue the following commands:
sudo pmset repeat wake MWRS 09:00:00 for the former
sudo pmset repeat wake TFU... (1 Reply)
Discussion started by: scrutinizerix
1 Replies
LEARN ABOUT OSF1
sleep
sleep(9r)sleep(9r)NAME
sleep - General: Puts a calling process to sleep
SYNOPSIS
void sleep(
caddr_t *channel,
long pri );
ARGUMENTS
Specifies a unique address associated with the calling kernel thread to be put to sleep. Specifies whether the sleep request is interrupt-
ible. Setting this argument to the PCATCH flag causes the process to sleep in an interruptible state (that is, the kernel thread can take
asynchronous signals). Not setting the PCATCH flag causes the process to sleep in an uninterruptible state (that is, the kernel thread can-
not take asynchronous signals).
DESCRIPTION
The sleep routine puts a calling process to sleep on the address specified by the channel argument. Some common addresses are the lbolt
argument, a buf structure, and a proc structure. This address should be unique to prevent unexpected wake/sleep cycles, which can occur if
different processes are sleeping on the same address accidentally. If you set the PCATCH flag in the pri argument, the sleep routine puts
signals on the queue and does not wake up the sleeping process.
The sleep and wakeup routines block and then wake up a process. Generally, device drivers call these routines to wait for the transfer to
complete an interrupt from the device. That is, the write routine of the device driver sleeps on the address of a known location, and the
device's Interrupt Service Interface (ISI) wakes the process when the device interrupts. It is the responsibility of the wakened process to
check if the condition for which it was sleeping has been removed.
NOTES
The operating system provides two ways to put a process to sleep: interruptible and uninterruptible. The sleep routine performs an uninter-
ruptible sleep operation if you do not set the PCATCH flag and an interruptible sleep operation if you set the PCATCH flag. This means
that device drivers cannot call sleep at interrupt context because at interrupt context there is no calling process to be put to sleep.
Thus, a device driver's Interrupt Service Interface (ISI) and those routines called from within the ISI must not call the sleep routine.
On this operating system, you cannot use pri to set the scheduling priority of the calling process.
RETURN VALUES
None
FILES SEE ALSO
Routines: wakeup(9r)sleep(9r)