More workarounds to get things compiling and running correctly with MSVC6.

This commit is contained in:
chris 2003-10-24 00:37:11 +00:00
parent 04ff2a3424
commit 7c211498e3
3 changed files with 23 additions and 1 deletions

View File

@ -197,7 +197,7 @@ public:
return true;
}
static void do_upcall(Handler& handler)
static void do_upcall(Handler handler)
{
try
{

View File

@ -74,6 +74,10 @@ size_t recv_n(Stream& s, void* data, size_t length,
namespace detail
{
#if defined(_MSC_VER)
static void recv_n_optimiser_bug_workaround() {}
#endif // _MSC_VER
template <typename Stream, typename Handler, typename Completion_Context>
class recv_n_handler
{
@ -95,6 +99,13 @@ namespace detail
total_recvd_ += bytes_recvd;
if (e || bytes_recvd == 0 || total_recvd_ == length_)
{
#if defined(_MSC_VER)
// Unless we put this function call here, the MSVC6 optimiser totally
// removes this function (incorrectly of course) and async_recv_n calls
// may not work correctly.
recv_n_optimiser_bug_workaround();
#endif // _MSC_VER
stream_.demuxer().operation_immediate(detail::bind_handler(handler_, e,
total_recvd_, bytes_recvd), context_, true);
}

View File

@ -74,6 +74,10 @@ size_t send_n(Stream& s, const void* data, size_t length,
namespace detail
{
#if defined(_MSC_VER)
static void send_n_optimiser_bug_workaround() {}
#endif // _MSC_VER
template <typename Stream, typename Handler, typename Completion_Context>
class send_n_handler
{
@ -95,6 +99,13 @@ namespace detail
total_sent_ += bytes_sent;
if (e || bytes_sent == 0 || total_sent_ == length_)
{
#if defined(_MSC_VER)
// Unless we put this function call here, the MSVC6 optimiser totally
// removes this function (incorrectly of course) and async_send_n calls
// may not work correctly.
send_n_optimiser_bug_workaround();
#endif // _MSC_VER
stream_.demuxer().operation_immediate(detail::bind_handler(handler_, e,
total_sent_, bytes_sent), context_, true);
}