简体   繁体   中英

What is a thread-safe way to break out of a POCO::HTTPSClientSession::receiveResponse?

The receiveResponse call is blocking, and while I run the code on a separate thread, I'd like to be able to cleanly stop the thread at any time. The documentation shows abort() may be what I need, but I can't find any information indicating whether it's thread-safe or not. Thanks,

HTTPSClientSession::abort() calls shutdown() on the socket; that should cause receiveResponse() to return (CORRECTION: to throw ).

HTTP(S)ClientSession has no internal locking but thread-safety here is not really a Poco-related question. If it is safe to call shutdown() on a socket blocked on recv() for your platform/stack, then all is good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM