Boost logo

Boost Users :

From: Reynolds, John (John.Reynolds_at_[hidden])
Date: 2008-06-17 10:49:58


Matthias

I believe that only certain boost thread methods such as sleep can be interrupted. What you could do is a loop that calls select with a timeout and only call a blocking accept when there is socket activity or you could loop with a non-blocking accept.

I assume that asio does this much better than what I have described.

John Reynolds
Aircraft Management Technologies Limited
Registered in Ireland, No.337561
Registered office: 1 The Green, Malahide, Co.Dublin, Ireland
Tel: + 353 1 8061000
Fax:+ 353 1 8061025

John.Reynolds_at_[hidden]
www.flightman.com

THE INFORMATION IN THIS E-MAIL IS CONFIDENTIAL AND MAY BE LEGALLY PRIVILEGED. IT IS INTENDED SOLELY FOR THE ADDRESSEE. ACCESS TO THIS E-MAIL BY ANYONE ELSE IS UNAUTHORISED. IF YOU ARE NOT THE INTENDED RECIPIENT, ANY DISCLOSURE, COPYRIGHT, DISTRIBUTION OR ANY ACTION TAKEN OR OMITTED TO BE TAKEN IN RELIANCE ON IT, IS PROHIBITED AND MAY BE UNLAWFUL.

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Matthias Vallentin
Sent: 17 June 2008 10:14
To: boost-users_at_[hidden]
Subject: [Boost-users] Interrupting Threads with boost::thread::interrupt()

Hi folks,

I am having issues with boost::thread::interrupt(). As far as I understood, calling this function will throw an exception in the corresponding thread. How can deal with blocking functions, such as a calls to accept() or when a thread is waiting on a condition variable to change? Basically the thread blocks somewhere in a while (true) loop.

Injecting interruption points manually with
boost::this_thread::interruption_point() does not seem to help here either. boost::thread::interrupt() (or interrupt_all in a thread_group), simply does not return.

Regards,

   Matthias

--
Matthias Vallentin
vallentin_at_[hidden]
pgp/gpg: 0x37F34C16
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net