| 1 | *** a/boost/asio/datagram_socket_service.hpp 2013-09-22 15:13:33.000000000 -0700
|
|---|
| 2 | --- b/boost/asio/datagram_socket_service.hpp 2014-05-06 04:20:40.438047289 -0700
|
|---|
| 3 | ***************
|
|---|
| 4 | *** 22,27 ****
|
|---|
| 5 | --- 22,31 ----
|
|---|
| 6 | #include <boost/asio/error.hpp>
|
|---|
| 7 | #include <boost/asio/io_service.hpp>
|
|---|
| 8 |
|
|---|
| 9 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 10 | + # include <boost/asio/detail/mutex.hpp>
|
|---|
| 11 | + #endif
|
|---|
| 12 | +
|
|---|
| 13 | #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|---|
| 14 | # include <boost/asio/detail/null_socket_service.hpp>
|
|---|
| 15 | #elif defined(BOOST_ASIO_HAS_IOCP)
|
|---|
| 16 | ***************
|
|---|
| 17 | *** 135,140 ****
|
|---|
| 18 | --- 139,147 ----
|
|---|
| 19 | /// Destroy a datagram socket implementation.
|
|---|
| 20 | void destroy(implementation_type& impl)
|
|---|
| 21 | {
|
|---|
| 22 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 23 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 24 | + #endif
|
|---|
| 25 | service_impl_.destroy(impl);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | ***************
|
|---|
| 29 | *** 167,172 ****
|
|---|
| 30 | --- 174,182 ----
|
|---|
| 31 | boost::system::error_code close(implementation_type& impl,
|
|---|
| 32 | boost::system::error_code& ec)
|
|---|
| 33 | {
|
|---|
| 34 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 35 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 36 | + #endif
|
|---|
| 37 | return service_impl_.close(impl, ec);
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 | ***************
|
|---|
| 41 | *** 186,191 ****
|
|---|
| 42 | --- 196,204 ----
|
|---|
| 43 | boost::system::error_code cancel(implementation_type& impl,
|
|---|
| 44 | boost::system::error_code& ec)
|
|---|
| 45 | {
|
|---|
| 46 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 47 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 48 | + #endif
|
|---|
| 49 | return service_impl_.cancel(impl, ec);
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | ***************
|
|---|
| 53 | *** 225,230 ****
|
|---|
| 54 | --- 238,246 ----
|
|---|
| 55 | const endpoint_type& peer_endpoint,
|
|---|
| 56 | BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
|
|---|
| 57 | {
|
|---|
| 58 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 59 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 60 | + #endif
|
|---|
| 61 | detail::async_result_init<
|
|---|
| 62 | ConnectHandler, void (boost::system::error_code)> init(
|
|---|
| 63 | BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
|
|---|
| 64 | ***************
|
|---|
| 65 | *** 322,327 ****
|
|---|
| 66 | --- 338,346 ----
|
|---|
| 67 | socket_base::message_flags flags,
|
|---|
| 68 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 69 | {
|
|---|
| 70 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 71 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 72 | + #endif
|
|---|
| 73 | detail::async_result_init<
|
|---|
| 74 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 75 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 76 | ***************
|
|---|
| 77 | *** 349,354 ****
|
|---|
| 78 | --- 368,376 ----
|
|---|
| 79 | socket_base::message_flags flags,
|
|---|
| 80 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 81 | {
|
|---|
| 82 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 83 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 84 | + #endif
|
|---|
| 85 | detail::async_result_init<
|
|---|
| 86 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 87 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 88 | ***************
|
|---|
| 89 | *** 377,382 ****
|
|---|
| 90 | --- 399,407 ----
|
|---|
| 91 | socket_base::message_flags flags,
|
|---|
| 92 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 93 | {
|
|---|
| 94 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 95 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 96 | + #endif
|
|---|
| 97 | detail::async_result_init<
|
|---|
| 98 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 99 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 100 | ***************
|
|---|
| 101 | *** 405,410 ****
|
|---|
| 102 | --- 430,438 ----
|
|---|
| 103 | socket_base::message_flags flags,
|
|---|
| 104 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 105 | {
|
|---|
| 106 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 107 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 108 | + #endif
|
|---|
| 109 | detail::async_result_init<
|
|---|
| 110 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 111 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 112 | ***************
|
|---|
| 113 | *** 424,429 ****
|
|---|
| 114 | --- 452,462 ----
|
|---|
| 115 |
|
|---|
| 116 | // The platform-specific implementation.
|
|---|
| 117 | service_impl_type service_impl_;
|
|---|
| 118 | +
|
|---|
| 119 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 120 | + // Per-socket lock used to make the socket service thread-safe
|
|---|
| 121 | + detail::mutex mutex_;
|
|---|
| 122 | + #endif
|
|---|
| 123 | };
|
|---|
| 124 |
|
|---|
| 125 | } // namespace asio
|
|---|
| 126 | *** a/boost/asio/raw_socket_service.hpp 2013-09-22 15:13:33.000000000 -0700
|
|---|
| 127 | --- b/boost/asio/raw_socket_service.hpp 2014-05-06 04:16:26.274052726 -0700
|
|---|
| 128 | ***************
|
|---|
| 129 | *** 22,27 ****
|
|---|
| 130 | --- 22,31 ----
|
|---|
| 131 | #include <boost/asio/error.hpp>
|
|---|
| 132 | #include <boost/asio/io_service.hpp>
|
|---|
| 133 |
|
|---|
| 134 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 135 | + # include <boost/asio/detail/mutex.hpp>
|
|---|
| 136 | + #endif
|
|---|
| 137 | +
|
|---|
| 138 | #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|---|
| 139 | # include <boost/asio/detail/null_socket_service.hpp>
|
|---|
| 140 | #elif defined(BOOST_ASIO_HAS_IOCP)
|
|---|
| 141 | ***************
|
|---|
| 142 | *** 167,172 ****
|
|---|
| 143 | --- 171,179 ----
|
|---|
| 144 | boost::system::error_code close(implementation_type& impl,
|
|---|
| 145 | boost::system::error_code& ec)
|
|---|
| 146 | {
|
|---|
| 147 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 148 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 149 | + #endif
|
|---|
| 150 | return service_impl_.close(impl, ec);
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | ***************
|
|---|
| 154 | *** 186,191 ****
|
|---|
| 155 | --- 193,201 ----
|
|---|
| 156 | boost::system::error_code cancel(implementation_type& impl,
|
|---|
| 157 | boost::system::error_code& ec)
|
|---|
| 158 | {
|
|---|
| 159 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 160 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 161 | + #endif
|
|---|
| 162 | return service_impl_.cancel(impl, ec);
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | ***************
|
|---|
| 166 | *** 225,230 ****
|
|---|
| 167 | --- 235,243 ----
|
|---|
| 168 | const endpoint_type& peer_endpoint,
|
|---|
| 169 | BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
|
|---|
| 170 | {
|
|---|
| 171 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 172 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 173 | + #endif
|
|---|
| 174 | detail::async_result_init<
|
|---|
| 175 | ConnectHandler, void (boost::system::error_code)> init(
|
|---|
| 176 | BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
|
|---|
| 177 | ***************
|
|---|
| 178 | *** 302,307 ****
|
|---|
| 179 | --- 315,323 ----
|
|---|
| 180 | boost::system::error_code shutdown(implementation_type& impl,
|
|---|
| 181 | socket_base::shutdown_type what, boost::system::error_code& ec)
|
|---|
| 182 | {
|
|---|
| 183 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 184 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 185 | + #endif
|
|---|
| 186 | return service_impl_.shutdown(impl, what, ec);
|
|---|
| 187 | }
|
|---|
| 188 |
|
|---|
| 189 | ***************
|
|---|
| 190 | *** 322,327 ****
|
|---|
| 191 | --- 338,346 ----
|
|---|
| 192 | socket_base::message_flags flags,
|
|---|
| 193 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 194 | {
|
|---|
| 195 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 196 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 197 | + #endif
|
|---|
| 198 | detail::async_result_init<
|
|---|
| 199 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 200 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 201 | ***************
|
|---|
| 202 | *** 349,354 ****
|
|---|
| 203 | --- 368,376 ----
|
|---|
| 204 | socket_base::message_flags flags,
|
|---|
| 205 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 206 | {
|
|---|
| 207 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 208 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 209 | + #endif
|
|---|
| 210 | detail::async_result_init<
|
|---|
| 211 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 212 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 213 | ***************
|
|---|
| 214 | *** 377,382 ****
|
|---|
| 215 | --- 399,407 ----
|
|---|
| 216 | socket_base::message_flags flags,
|
|---|
| 217 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 218 | {
|
|---|
| 219 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 220 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 221 | + #endif
|
|---|
| 222 | detail::async_result_init<
|
|---|
| 223 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 224 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 225 | ***************
|
|---|
| 226 | *** 405,410 ****
|
|---|
| 227 | --- 430,438 ----
|
|---|
| 228 | socket_base::message_flags flags,
|
|---|
| 229 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 230 | {
|
|---|
| 231 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 232 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 233 | + #endif
|
|---|
| 234 | detail::async_result_init<
|
|---|
| 235 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 236 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 237 | ***************
|
|---|
| 238 | *** 419,429 ****
|
|---|
| 239 | --- 447,465 ----
|
|---|
| 240 | // Destroy all user-defined handler objects owned by the service.
|
|---|
| 241 | void shutdown_service()
|
|---|
| 242 | {
|
|---|
| 243 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 244 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 245 | + #endif
|
|---|
| 246 | service_impl_.shutdown_service();
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | // The platform-specific implementation.
|
|---|
| 250 | service_impl_type service_impl_;
|
|---|
| 251 | +
|
|---|
| 252 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 253 | + // Per-socket lock used to make the socket service thread-safe
|
|---|
| 254 | + detail::mutex mutex_;
|
|---|
| 255 | + #endif
|
|---|
| 256 | };
|
|---|
| 257 |
|
|---|
| 258 | } // namespace asio
|
|---|
| 259 | *** a/boost/asio/seq_packet_socket_service.hpp 2013-09-22 15:13:33.000000000 -0700
|
|---|
| 260 | --- b/boost/asio/seq_packet_socket_service.hpp 2014-05-06 04:16:26.274052726 -0700
|
|---|
| 261 | ***************
|
|---|
| 262 | *** 22,27 ****
|
|---|
| 263 | --- 22,31 ----
|
|---|
| 264 | #include <boost/asio/error.hpp>
|
|---|
| 265 | #include <boost/asio/io_service.hpp>
|
|---|
| 266 |
|
|---|
| 267 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 268 | + # include <boost/asio/detail/mutex.hpp>
|
|---|
| 269 | + #endif
|
|---|
| 270 | +
|
|---|
| 271 | #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|---|
| 272 | # include <boost/asio/detail/null_socket_service.hpp>
|
|---|
| 273 | #elif defined(BOOST_ASIO_HAS_IOCP)
|
|---|
| 274 | ***************
|
|---|
| 275 | *** 137,142 ****
|
|---|
| 276 | --- 141,149 ----
|
|---|
| 277 | /// Destroy a sequenced packet socket implementation.
|
|---|
| 278 | void destroy(implementation_type& impl)
|
|---|
| 279 | {
|
|---|
| 280 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 281 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 282 | + #endif
|
|---|
| 283 | service_impl_.destroy(impl);
|
|---|
| 284 | }
|
|---|
| 285 |
|
|---|
| 286 | ***************
|
|---|
| 287 | *** 169,174 ****
|
|---|
| 288 | --- 176,184 ----
|
|---|
| 289 | boost::system::error_code close(implementation_type& impl,
|
|---|
| 290 | boost::system::error_code& ec)
|
|---|
| 291 | {
|
|---|
| 292 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 293 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 294 | + #endif
|
|---|
| 295 | return service_impl_.close(impl, ec);
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | ***************
|
|---|
| 299 | *** 188,193 ****
|
|---|
| 300 | --- 198,206 ----
|
|---|
| 301 | boost::system::error_code cancel(implementation_type& impl,
|
|---|
| 302 | boost::system::error_code& ec)
|
|---|
| 303 | {
|
|---|
| 304 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 305 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 306 | + #endif
|
|---|
| 307 | return service_impl_.cancel(impl, ec);
|
|---|
| 308 | }
|
|---|
| 309 |
|
|---|
| 310 | ***************
|
|---|
| 311 | *** 227,232 ****
|
|---|
| 312 | --- 240,248 ----
|
|---|
| 313 | const endpoint_type& peer_endpoint,
|
|---|
| 314 | BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
|
|---|
| 315 | {
|
|---|
| 316 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 317 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 318 | + #endif
|
|---|
| 319 | detail::async_result_init<
|
|---|
| 320 | ConnectHandler, void (boost::system::error_code)> init(
|
|---|
| 321 | BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
|
|---|
| 322 | ***************
|
|---|
| 323 | *** 304,309 ****
|
|---|
| 324 | --- 320,328 ----
|
|---|
| 325 | boost::system::error_code shutdown(implementation_type& impl,
|
|---|
| 326 | socket_base::shutdown_type what, boost::system::error_code& ec)
|
|---|
| 327 | {
|
|---|
| 328 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 329 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 330 | + #endif
|
|---|
| 331 | return service_impl_.shutdown(impl, what, ec);
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 | ***************
|
|---|
| 335 | *** 325,330 ****
|
|---|
| 336 | --- 344,352 ----
|
|---|
| 337 | socket_base::message_flags flags,
|
|---|
| 338 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 339 | {
|
|---|
| 340 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 341 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 342 | + #endif
|
|---|
| 343 | detail::async_result_init<
|
|---|
| 344 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 345 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 346 | ***************
|
|---|
| 347 | *** 353,358 ****
|
|---|
| 348 | --- 375,383 ----
|
|---|
| 349 | socket_base::message_flags& out_flags,
|
|---|
| 350 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 351 | {
|
|---|
| 352 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 353 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 354 | + #endif
|
|---|
| 355 | detail::async_result_init<
|
|---|
| 356 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 357 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 358 | ***************
|
|---|
| 359 | *** 367,377 ****
|
|---|
| 360 | --- 392,410 ----
|
|---|
| 361 | // Destroy all user-defined handler objects owned by the service.
|
|---|
| 362 | void shutdown_service()
|
|---|
| 363 | {
|
|---|
| 364 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 365 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 366 | + #endif
|
|---|
| 367 | service_impl_.shutdown_service();
|
|---|
| 368 | }
|
|---|
| 369 |
|
|---|
| 370 | // The platform-specific implementation.
|
|---|
| 371 | service_impl_type service_impl_;
|
|---|
| 372 | +
|
|---|
| 373 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 374 | + // Per-socket lock used to make the socket service thread-safe
|
|---|
| 375 | + detail::mutex mutex_;
|
|---|
| 376 | + #endif
|
|---|
| 377 | };
|
|---|
| 378 |
|
|---|
| 379 | } // namespace asio
|
|---|
| 380 | *** a/boost/asio/stream_socket_service.hpp 2013-09-22 15:13:33.000000000 -0700
|
|---|
| 381 | --- b/boost/asio/stream_socket_service.hpp 2014-05-06 04:16:26.274052726 -0700
|
|---|
| 382 | ***************
|
|---|
| 383 | *** 22,27 ****
|
|---|
| 384 | --- 22,31 ----
|
|---|
| 385 | #include <boost/asio/error.hpp>
|
|---|
| 386 | #include <boost/asio/io_service.hpp>
|
|---|
| 387 |
|
|---|
| 388 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 389 | + # include <boost/asio/detail/mutex.hpp>
|
|---|
| 390 | + #endif
|
|---|
| 391 | +
|
|---|
| 392 | #if defined(BOOST_ASIO_WINDOWS_RUNTIME)
|
|---|
| 393 | # include <boost/asio/detail/winrt_ssocket_service.hpp>
|
|---|
| 394 | #elif defined(BOOST_ASIO_HAS_IOCP)
|
|---|
| 395 | ***************
|
|---|
| 396 | *** 135,140 ****
|
|---|
| 397 | --- 139,147 ----
|
|---|
| 398 | /// Destroy a stream socket implementation.
|
|---|
| 399 | void destroy(implementation_type& impl)
|
|---|
| 400 | {
|
|---|
| 401 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 402 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 403 | + #endif
|
|---|
| 404 | service_impl_.destroy(impl);
|
|---|
| 405 | }
|
|---|
| 406 |
|
|---|
| 407 | ***************
|
|---|
| 408 | *** 167,172 ****
|
|---|
| 409 | --- 174,182 ----
|
|---|
| 410 | boost::system::error_code close(implementation_type& impl,
|
|---|
| 411 | boost::system::error_code& ec)
|
|---|
| 412 | {
|
|---|
| 413 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 414 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 415 | + #endif
|
|---|
| 416 | return service_impl_.close(impl, ec);
|
|---|
| 417 | }
|
|---|
| 418 |
|
|---|
| 419 | ***************
|
|---|
| 420 | *** 186,191 ****
|
|---|
| 421 | --- 196,204 ----
|
|---|
| 422 | boost::system::error_code cancel(implementation_type& impl,
|
|---|
| 423 | boost::system::error_code& ec)
|
|---|
| 424 | {
|
|---|
| 425 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 426 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 427 | + #endif
|
|---|
| 428 | return service_impl_.cancel(impl, ec);
|
|---|
| 429 | }
|
|---|
| 430 |
|
|---|
| 431 | ***************
|
|---|
| 432 | *** 225,230 ****
|
|---|
| 433 | --- 238,246 ----
|
|---|
| 434 | const endpoint_type& peer_endpoint,
|
|---|
| 435 | BOOST_ASIO_MOVE_ARG(ConnectHandler) handler)
|
|---|
| 436 | {
|
|---|
| 437 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 438 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 439 | + #endif
|
|---|
| 440 | detail::async_result_init<
|
|---|
| 441 | ConnectHandler, void (boost::system::error_code)> init(
|
|---|
| 442 | BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler));
|
|---|
| 443 | ***************
|
|---|
| 444 | *** 302,307 ****
|
|---|
| 445 | --- 318,326 ----
|
|---|
| 446 | boost::system::error_code shutdown(implementation_type& impl,
|
|---|
| 447 | socket_base::shutdown_type what, boost::system::error_code& ec)
|
|---|
| 448 | {
|
|---|
| 449 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 450 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 451 | + #endif
|
|---|
| 452 | return service_impl_.shutdown(impl, what, ec);
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | ***************
|
|---|
| 456 | *** 323,328 ****
|
|---|
| 457 | --- 342,350 ----
|
|---|
| 458 | socket_base::message_flags flags,
|
|---|
| 459 | BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
|
|---|
| 460 | {
|
|---|
| 461 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 462 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 463 | + #endif
|
|---|
| 464 | detail::async_result_init<
|
|---|
| 465 | WriteHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 466 | BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
|
|---|
| 467 | ***************
|
|---|
| 468 | *** 350,355 ****
|
|---|
| 469 | --- 372,380 ----
|
|---|
| 470 | socket_base::message_flags flags,
|
|---|
| 471 | BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
|
|---|
| 472 | {
|
|---|
| 473 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 474 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 475 | + #endif
|
|---|
| 476 | detail::async_result_init<
|
|---|
| 477 | ReadHandler, void (boost::system::error_code, std::size_t)> init(
|
|---|
| 478 | BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
|
|---|
| 479 | ***************
|
|---|
| 480 | *** 363,373 ****
|
|---|
| 481 | --- 388,406 ----
|
|---|
| 482 | // Destroy all user-defined handler objects owned by the service.
|
|---|
| 483 | void shutdown_service()
|
|---|
| 484 | {
|
|---|
| 485 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 486 | + detail::mutex::scoped_lock lock(mutex_);
|
|---|
| 487 | + #endif
|
|---|
| 488 | service_impl_.shutdown_service();
|
|---|
| 489 | }
|
|---|
| 490 |
|
|---|
| 491 | // The platform-specific implementation.
|
|---|
| 492 | service_impl_type service_impl_;
|
|---|
| 493 | +
|
|---|
| 494 | + #if defined(BOOST_ASIO_THREAD_SAFE_SOCKET_SERVICES)
|
|---|
| 495 | + // Per-socket lock used to make the socket service thread-safe
|
|---|
| 496 | + detail::mutex mutex_;
|
|---|
| 497 | + #endif
|
|---|
| 498 | };
|
|---|
| 499 |
|
|---|
| 500 | } // namespace asio
|
|---|