Sponsored Content
Top Forums Programming how to wake up a thread that blocking at epoll_wait? Post 302267841 by cometeor on Sunday 14th of December 2008 06:23:15 AM
Old 12-14-2008
how to wake up a thread that blocking at epoll_wait?

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 posted message be handled. So I want to wakeup the blocking thread when posting message to it.
Any suggestion?
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Wake on Lan script

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)
Discussion started by: anon0mus
0 Replies

2. Shell Programming and Scripting

Wake on LAN script

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)
Discussion started by: anon0mus
6 Replies

3. UNIX for Advanced & Expert Users

wake up user space thread from kernel space ISR

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)
Discussion started by: aaronwong
0 Replies

4. UNIX for Dummies Questions & Answers

Linux Device Driver: how can an ISR wake up a user-thread?

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)
Discussion started by: agaurav
1 Replies

5. Programming

How to sleep and wake a thread???

Hi guys, I am creating two posix threads. I have some queries, hopefully you will help me out with them 1) How can I put a thread to indefinite sleep, for indefinite time period. I am familiar with this sleep(5); for 5 second, how can I make it indefinite?? 2) How can one thread wake another... (11 Replies)
Discussion started by: gabam
11 Replies

6. UNIX for Dummies Questions & Answers

Trouble Configuring Wake On Lan

As the title implies I'm having trouble setting up Wake-On-LAN with my Debian box. Here is the output from ethtool and my /etc/network/interfaces: # cat /etc/network/interfaces # /etc/network/interfaces - configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo... (2 Replies)
Discussion started by: Azrael
2 Replies

7. Programming

Which are blocking and non-blocking api's in sockets in C ?

among the below socket programming api's, please let me know which are blocking and non-blocking. socket accept bind listen write read close (2 Replies)
Discussion started by: VSSajjan
2 Replies

8. UNIX for Dummies Questions & Answers

Computer wake commands

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
mq_setattr(2)							System Calls Manual						     mq_setattr(2)

NAME
mq_setattr - set the blocking status of a message queue associated with a descriptor SYNOPSIS
DESCRIPTION
The system call changes the blocking status of a message queue associated with the descriptor, mqdes. The blocking status that is modified is per message queue descriptor and another open descriptor for the same message queue can have a different blocking status. The argument mqstat, points to an structure that specifies the blocking status desired. More specifically, if the bit in the mq_flags field of the structure is set, the descriptor is marked as non-blocking. Otherwise it is marked as blocking. If omstat is non-NULL, will store in the structure referenced by omqstat, the previous message queue attributes and the queue blocking sta- tus associated with this mqdes. The values returned are the same as would be returned by a call to To use this function, link in the realtime library by specifying on the compiler or linker command line. RETURN VALUE
returns the following values: Successful completion. Failure. is set to indicate the error. ERRORS
If fails, is set to one of the following values: [EBADF] mqdes is not a valid message queue descriptor. [EINVAL] mqstat does not point to a valid structure, or omqstat is non-NULL and does not point to a valid structure. [ENOSYS] is not supported by the implementation. SEE ALSO
mq_getattr(2), mq_open(2). STANDARDS CONFORMANCE
mq_setattr(2)
All times are GMT -4. The time now is 09:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy