[
https://issues.apache.org/jira/browse/THRIFT-1890?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13605191#comment-13605191
]
Ben Craig commented on THRIFT-1890:
-----------------------------------
Did some testing, and didn't have much luck. I was using a ThreadedServer.
acceptImpl was sitting on WaitForSingleObject, even though I had called stop
(and therefore interrupt + CancelIo) on my "main" thread.
I looked at the documentation for CancelIo, and it claims that it will only
cancel io on the current thread. That suggests that the "cleanup" usage inside
of acceptImpl is fine, but the usage inside of interrupt is not. I can think
of two alternatives off of the top of my head:
1. Use CancelIoEx. That will require you to share an overlapped structure
between acceptImpl and interrupt. That might be tricky on the synchronization
side.
2. Create an extra event for interruption, and use WaitForMultipleObjects
inside of acceptImpl. Interrupt can then signal your extra event to "wake up"
WaitForMultipleObjects, and that will give you the opportunity to check the
_stop flag, or do something else to let the server tear down.
> C++: Make named pipes server work asynchronously
> -------------------------------------------------
>
> Key: THRIFT-1890
> URL: https://issues.apache.org/jira/browse/THRIFT-1890
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Environment: Windows
> Reporter: Jens Geyer
> Assignee: Jens Geyer
> Fix For: 1.0
>
> Attachments:
> THRIFT-1890_Cpp_Make_named_pipes_server_work_asynchronously.patch
>
>
> Currently the named pipe server cannot be stopped gracefully due to the way
> ConnectNamedPipe() works for synchronous named pipes. The recommended
> solution is to run the pipe in "overlapped" mode, allowing the transport to
> be closed cleanly.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira