Opened 11 years ago
Closed 10 years ago
#6548 closed Bugs (invalid)
boost asio async_accept thread context
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.46.1 | Severity: | Problem |
Keywords: | c++ networking unix socket | Cc: | aladjev.andrew@… |
Description
how to see the problem: 1) compile attached cpp 2) run program 2) accept /tmp/test unix socket more than 2 times
the output will be like: start from 0x1215810 start from 0x12154c0 accept from 0x12154c0, async_accept from 0x1215810 accept from 0x12154c0, async_accept from 0x12154c0 and program is still running!
the output should be like: start from 0x1215810 start from 0x12154c0 accept from 0x1215810, async_accept from 0x1215810 accept from 0x12154c0, async_accept from 0x12154c0 and program should stop!
Attachments (1)
Change History (3)
by , 11 years ago
Attachment: | asio_bug.cpp added |
---|
comment:1 by , 11 years ago
comment:2 by , 10 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Your conclusion is not correct. There is only one acceptor object, and all of its completion handlers will be delivered through its associated io_service, which in this case is io_1
. Which thread you start the async_accept
operation from does not matter.
The program does not stop because you have created io_service::work
objects that you do not destroy. See here for more details.
the output will be like:
start from 0x1215810
start from 0x12154c0
accept from 0x12154c0, async_accept from 0x1215810
accept from 0x12154c0, async_accept from 0x12154c0
and program is still running!
the output should be like:
start from 0x1215810
start from 0x12154c0
accept from 0x1215810, async_accept from 0x1215810
accept from 0x12154c0, async_accept from 0x12154c0
and program should stop!