LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-30-2004, 10:44 AM   #1
b2na
LQ Newbie
 
Registered: Dec 2004
Location: Bucharest
Distribution: debian
Posts: 4

Rep: Reputation: 0
pselect threads signals


hi.
I have to do an application in which more clients can connect to a server requesting some io operations. The server must handle all this requests in a number of threads. The number of threads that the server has, is limited, but not the io operations requested by the clients. So, I will use aio operations and when an aio operation ends a signal will be sent to the thread.

I can handle all this except I have a problem. I don't know how to handle the requests from the clients and the signals in the same time. pselect might be the answer but I can't understand properly how it works. Is it blocant?
Let's say I have a signal that will announce to the threads when the aio operation ends. This signal will be sent to the process and the handler will see what thread must receive this signal and will "forward" it.
But, in the main thread I have the "select". Will this signal stop the "select"? Should I use pselect instead and block the signal before? And if I do so, this, won't block my application cause pselect is blocant as I understood.

Can someone please, give some details...
Thank you.
 
Old 12-30-2004, 11:22 PM   #2
fr0zen
Member
 
Registered: Nov 2003
Location: 127.0.0.1
Distribution: xubuntu
Posts: 217

Rep: Reputation: 30
The select function will be interrupted by incoming signals to the process or thread itself. This means you need to check for when select returns -1 and errno is set to "EINTR".
 
Old 12-31-2004, 10:50 AM   #3
b2na
LQ Newbie
 
Registered: Dec 2004
Location: Bucharest
Distribution: debian
Posts: 4

Original Poster
Rep: Reputation: 0
... and if the signal is handled?
 
  


Reply



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
Java threads listed using kill -3 does not contain all threads found using ps -auxww coneheed Programming 2 11-14-2005 08:57 AM
Signals Speek Programming 2 12-24-2004 04:58 AM
Java Threads vs Native Threads rjmendez Programming 0 08-16-2004 05:58 AM
sending signal to thread waiting on pselect exedx Programming 4 03-21-2004 11:48 PM
pselect function. nio99 Linux - Software 0 12-14-2002 08:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:12 PM.

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