Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-03-2004, 02:59 AM   #1
LQ Newbie
Registered: May 2004
Posts: 3

Rep: Reputation: 0
Question Waking up only one process from a wait queue

Hi everyone,

I'm trying to wake up a single process from a queue like this:



asmlinkge int sys_wait(){

asmlinkage int sys_signal(){
if(!queue) return -EINVAL;
struct task_struct *p = queue->task;
queue = queue->next;
return 0;

So when I invoke signal() I get null pointer error or for some other code variation no one wakes up.
Can anyone tell me the thing I don't know about the queues and scheduler that makes me fail?

Thank you
Old 05-07-2004, 02:18 AM   #2
LQ Newbie
Registered: May 2004
Posts: 3

Original Poster
Rep: Reputation: 0

I must add that I do null pointer checking.
I also tried it with remove_from_wait_queue folowed by wake_up_process. They dont work as expected. I searched the web and found out that there is something called TASK_EXCLUSIVE but this is not supported by the kernel I am working on either.

The closest I get is when I tried to clone wake_up system call with a slight modification. It returns after awaking first process from the queue. This works without any error but sometimes no one wakes.

Thank you
Old 05-07-2004, 12:20 PM   #3
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
use add_wait_queue_exclusive() and wake_up_interruptible_nr(the_queu, 1); i wrote this a couple months ago, . you can define the TASK_EXCLUSIVE flag yourself.
Old 05-12-2004, 04:12 AM   #4
LQ Newbie
Registered: May 2004
Posts: 3

Original Poster
Rep: Reputation: 0
Thank you infamous41md.

It really helped alot. :>)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ACPI shuting down when should be waking up navarre9 Linux - General 1 12-25-2005 03:18 AM
Not waking from second suspend ritme909 Linux - Laptop and Netbook 0 01-29-2005 08:19 AM
wait() and signal() applies on which process ...? indian Programming 5 12-01-2004 03:43 PM
Is it just me or is Linux waking up? orange400 Linux - General 2 03-03-2003 06:15 AM
The painstaking process of post and wait... Shabung Linux - Newbie 3 11-10-2002 07:17 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:12 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration