Boost Users :
Subject: [Boost-users] boost - asio - advise
From: Tim Pynegar (tim_at_[hidden])
Date: 2009-05-09 15:09:47
I'm trying to use asio for a udp client / server arrangment. I started
by calling run on the
io_service object on a separate thread and the using the async_read_from
async_send_to. I was calling these from the main application thread. I
was getting a lot
of these errors that was causing an exception on the io_service run method.
First-chance exception at 0x7c812afb in Testbed.exe: Microsoft C++
exception: boost::system::system_error at memory location 0x0012e29c. An
invalid argument was supplied
This happens after calling the async_send_to method. I've added in a
send buffer and
started to poll the io_service object instead of running it on it's own
has cut down the freqency this is happening however on occations it
still does and i'd
like to have it running on it's own thread.
The question is really should i put in a mutex lock in my sendto
function that call's the
async_send_to that is unlocked when i recieve the handlesentto callback
when the async_send_to is finished. If i do this doesn't this basically
make it a blocking
function call in the same way as if i call the regular send_to function.
There are other
options i've thought of but they all seem to result in it basically
I've looked through the examples and there is a lot of different
to make and was looking to see if anyone could advise on an arrangement
allow for using multiple threads but block as little as possible.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net