From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcda7,aa6f820f3f67c7ef X-Google-Attributes: gidfcda7,public X-Google-Thread: 11035d,aa6f820f3f67c7ef X-Google-Attributes: gid11035d,public X-Google-Thread: fa528,aa6f820f3f67c7ef X-Google-Attributes: gidfa528,public X-Google-Thread: 115614,aa6f820f3f67c7ef X-Google-Attributes: gid115614,public X-Google-Thread: 10650a,aa6f820f3f67c7ef X-Google-Attributes: gid10650a,public X-Google-ArrivalTime: 2001-04-12 20:42:07 PST Path: supernews.google.com!sn-xit-03!supernews.com!freenix!fr.usenet-edu.net!usenet-edu.net!bignews.mediaways.net!abq.news.ans.net!news.chips.ibm.com!newsfeed.btv.ibm.com!hanover.torolab.ibm.com!tornews.torolab.ibm.com!ausnews.austin.ibm.com!not-for-mail From: lathamr@us.ibm.com (Richard D. Latham) Newsgroups: comp.unix.internals,comp.unix.solaris,comp.unix.tru64,comp.sys.hp.hpux,comp.unix.aix Subject: Re: awaking a thread ... waiting on select or poll Date: 12 Apr 2001 21:21:02 -0600 Organization: IBM Austin Sender: lathamr@lathamr Message-ID: References: NNTP-Posting-Host: lig32-227-170-26.us.lig-dial.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Crater Lake) Xref: supernews.google.com comp.unix.internals:488 comp.unix.solaris:38071 comp.unix.tru64:2116 comp.sys.hp.hpux:8695 comp.unix.aix:14813 "MrSignor" writes: > Is there a reliable way (across Unix platforms) to wake-up a thread > sleeping/waiting on a Select or Poll, that is not timing out the request. > > Basically, I have a thread, waiting for work on 1-n sockets. Upon > occassion, I would like to wake the sleeping-thread, because I > need to bring something to it's attention. > Well, I alsmot hesitate to mention this because threads and signals are like oil and water ... they don't mix very well :-) But IIRC, you could use SIGUSR1 or SIGUSR2 to wake your other thread out of a blocking select() or recv(). Note that several of the "middleware" products , notably MQ Series, use threads and signals themselves ... and you have to play by their rules if you're linking those libaries into your executable. Hope this helps. -- #include /* I don't speak for IBM ... */ /* Heck, I don't even speak for myself */ /* Don't believe me ? Ask my wife :-) */ Richard D. Latham lathamr@us.ibm.com