Overview
Features
Download
Documentation
Community
Add-Ons & Services

Poco::Thread - terminate

General discussion regarding the development of POCO for contributors.

Poco::Thread - terminate

Postby cast » 19 Mar 2009, 12:45

Hello, friends! Maby anybody help me...
In definition of class Poco::Thread, I can not find terminate method, why??
Or there is other way to terminate thread?
one method - sleep to suspend thread is not right implementation!
cast
 
Posts: 1
Joined: 19 Mar 2009, 12:31

Re: Poco::Thread - terminate

Postby alex » 19 Mar 2009, 14:12

cast wrote:In definition of class Poco::Thread, I can not find terminate method, why??

Because terminating thread is
Herb Sutter wrote:A time honored way to randomly corrupt your state and achieve undefined behavior.

cast wrote:Or there is other way to terminate thread?

Yes:
Herb Sutter wrote:Set flag politely, let it poll if it wants.

cast wrote:one method - sleep to suspend thread is not right implementation!

The purpose of sleep() is not to terminate the thread, so in that sense you are right that it is not right implementation of termination functionality. At any rate, shouting at us about how wrong we are won't get you far. I suggest you reconsider, read the whole article and then come back. If you still hold the same belief, I'd be curious to hear your arguments in favor of it alongside with details of your proposed implementation which avoids the pitfalls described in the mentioned article.
alex
 
Posts: 1086
Joined: 11 Jul 2006, 16:27
Location: United_States


Return to Contributors

Who is online

Users browsing this forum: No registered users and 0 guests

cron