how to wake up a thread that blocking at epoll_wait?


 
Thread Tools Search this Thread
Top Forums Programming how to wake up a thread that blocking at epoll_wait?
# 1  
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?
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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
Login or Register to Ask a Question
thread(9s)																thread(9s)

NAME
thread - General: Contains kernel threads-related information SYNOPSIS
---------------------------- Member Name Data Type ---------------------------- wait_result kern_return_t ---------------------------- MEMBERS
Specifies the outcome of the wait. The kernel can set this member to one of the following values: THREAD_AWAKENED, THREAD_INTERRUPTED, THREAD_TIMED_OUT, THREAD_SHOULD_TERMINATE, and THREAD_RESTART. DESCRIPTION
The thread data structure contains kernel threads-related information. Kernel modules typically use the wait_result member (with the cur- rent_thread routine) to check for the result of the wait. The values associated with the wait_result member have the following meanings: The result of the assert wait is a normal wakeup. The wait condition was interrupted by the clear_wait routine. The specified timeout has expired. The result of the assert wait is that the current kernel thread should terminate. The current kernel thread should be restarted. NOTES
The header file <thread.h> shows a typedef statement that assigns the alternate name thread_t for a pointer to the thread data structure. Many of the kernel threads-related routines operate on these pointers to thread data structures. The thread data structure is an opaque data structure; that is, all of its associated members (except for the wait_result member) are ref- erenced and manipulated by the operating system and not by the user of kernel threads. FILES
SEE ALSO
Routines: clear_wait(9r), current_thread(9r), thread_block(9r), thread_set_timeout(9r), thread_wakeup(9r), thread_wakeup_one(9r) thread(9s)