|
Boost : |
Subject: [boost] [asio] Pass some parameter to io_service::run
From: Dmytro Ovdiienko (dmitriy.ovdienko_at_[hidden])
Date: 2010-01-09 14:05:08
Hello All,
I'm new in boost asio. I'm trying to adapt this library to my existent
network application.
There is a problem with current application's architecture. I see no way to
pass some parameter to the completion routine from the io_service::run
calling thread.
Below brief application description. Hope this will help:
1. It is *low-latency* network application
2. Application processes incoming multicast UDP messages.
3. Number of multicast groups/ports is *unlimited*.
Technical details:
1. Application encapsulates udp::sockets subscribed to multicast group
2. udp::socket::async_receive method used to receive data
3. io_service::run is used in the thread pool to call socket's complete
routine.
4. Every thread of the pool encapsulates some object for messages
processing.
I need to pass reference to this object to the socket::async_receive
complete routine to complete message processing. This object allocates a lot
of memory and I cannot create it for every socket. It is possible to create
but there is no sense.
It is very important to avoid thread_local_storages and null_buffers to make
application as simple as possible without performance gaps.
I believe it is possible because POSIX and Windows I/O allow it.
Please help with advise.
Thanks.
Dima
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk