diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:33:54 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:36:09 +0900 |
commit | d9ec475d945d3035377a0d89ed42e382d8988891 (patch) | |
tree | 34aff2cee4b209906243ab5499d61f3edee2982f /boost/asio/detail/impl | |
parent | 71d216b90256936a9638f325af9bc69d720e75de (diff) | |
download | boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.gz boost-d9ec475d945d3035377a0d89ed42e382d8988891.tar.bz2 boost-d9ec475d945d3035377a0d89ed42e382d8988891.zip |
Imported Upstream version 1.60.0
Change-Id: Ie709530d6d5841088ceaba025cbe175a4ef43050
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/asio/detail/impl')
-rw-r--r-- | boost/asio/detail/impl/socket_ops.ipp | 12 | ||||
-rw-r--r-- | boost/asio/detail/impl/win_event.ipp | 12 | ||||
-rw-r--r-- | boost/asio/detail/impl/win_iocp_handle_service.ipp | 2 | ||||
-rw-r--r-- | boost/asio/detail/impl/win_mutex.ipp | 5 | ||||
-rw-r--r-- | boost/asio/detail/impl/win_static_mutex.ipp | 18 | ||||
-rw-r--r-- | boost/asio/detail/impl/win_thread.ipp | 12 |
6 files changed, 50 insertions, 11 deletions
diff --git a/boost/asio/detail/impl/socket_ops.ipp b/boost/asio/detail/impl/socket_ops.ipp index dc068e0e03..976eaa42db 100644 --- a/boost/asio/detail/impl/socket_ops.ipp +++ b/boost/asio/detail/impl/socket_ops.ipp @@ -1634,7 +1634,8 @@ int getpeername(socket_type s, socket_addr_type* addr, return socket_error_retval; } -#if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#if defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) \ + || defined(__CYGWIN__) if (cached) { // Check if socket is still connected. @@ -1655,9 +1656,11 @@ int getpeername(socket_type s, socket_addr_type* addr, ec = boost::system::error_code(); return 0; } -#else // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#else // defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) + // || defined(__CYGWIN__) (void)cached; -#endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__) +#endif // defined(BOOST_ASIO_WINDOWS) && !defined(BOOST_ASIO_WINDOWS_APP) + // || defined(__CYGWIN__) clear_last_error(); int result = error_wrapper(call_getpeername( @@ -2581,7 +2584,8 @@ inline void gai_strcpy(char* target, const char* source, std::size_t max_size) strcpy_s(target, max_size, source); #else // defined(BOOST_ASIO_HAS_SECURE_RTL) *target = 0; - strncat(target, source, max_size); + if (max_size > 0) + strncat(target, source, max_size - 1); #endif // defined(BOOST_ASIO_HAS_SECURE_RTL) } diff --git a/boost/asio/detail/impl/win_event.ipp b/boost/asio/detail/impl/win_event.ipp index 0fffbce9cd..40f3f641eb 100644 --- a/boost/asio/detail/impl/win_event.ipp +++ b/boost/asio/detail/impl/win_event.ipp @@ -32,7 +32,11 @@ namespace detail { win_event::win_event() : state_(0) { - events_[0] = ::CreateEvent(0, true, false, 0); +#if defined(BOOST_ASIO_WINDOWS_APP) + events_[0] = ::CreateEventExW(0, 0, CREATE_EVENT_MANUAL_RESET, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) + events_[0] = ::CreateEventW(0, true, false, 0); +#endif // defined(BOOST_ASIO_WINDOWS_APP) if (!events_[0]) { DWORD last_error = ::GetLastError(); @@ -41,7 +45,11 @@ win_event::win_event() boost::asio::detail::throw_error(ec, "event"); } - events_[1] = ::CreateEvent(0, false, false, 0); +#if defined(BOOST_ASIO_WINDOWS_APP) + events_[1] = ::CreateEventExW(0, 0, 0, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) + events_[1] = ::CreateEventW(0, false, false, 0); +#endif // defined(BOOST_ASIO_WINDOWS_APP) if (!events_[1]) { DWORD last_error = ::GetLastError(); diff --git a/boost/asio/detail/impl/win_iocp_handle_service.ipp b/boost/asio/detail/impl/win_iocp_handle_service.ipp index b0c784e556..24820a55b0 100644 --- a/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ b/boost/asio/detail/impl/win_iocp_handle_service.ipp @@ -40,7 +40,7 @@ public: OffsetHigh = 0; // Create a non-signalled manual-reset event, for GetOverlappedResult. - hEvent = ::CreateEvent(0, TRUE, FALSE, 0); + hEvent = ::CreateEventW(0, TRUE, FALSE, 0); if (hEvent) { // As documented in GetQueuedCompletionStatus, setting the low order diff --git a/boost/asio/detail/impl/win_mutex.ipp b/boost/asio/detail/impl/win_mutex.ipp index 60ce9dd598..be1d1b8111 100644 --- a/boost/asio/detail/impl/win_mutex.ipp +++ b/boost/asio/detail/impl/win_mutex.ipp @@ -44,6 +44,8 @@ int win_mutex::do_init() // we'll just call the Windows API and hope. # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + ::InitializeCriticalSectionEx(&crit_section_, 0x80000000, 0); # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) return ::GetLastError(); @@ -54,6 +56,9 @@ int win_mutex::do_init() { # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + if (!::InitializeCriticalSectionEx(&crit_section_, 0, 0)) + return ::GetLastError(); # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) return ::GetLastError(); diff --git a/boost/asio/detail/impl/win_static_mutex.ipp b/boost/asio/detail/impl/win_static_mutex.ipp index 02b44b5d37..14a08efd90 100644 --- a/boost/asio/detail/impl/win_static_mutex.ipp +++ b/boost/asio/detail/impl/win_static_mutex.ipp @@ -50,13 +50,23 @@ int win_static_mutex::do_init() mutex_name, 128, L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", static_cast<unsigned int>(::GetCurrentProcessId()), this); +#if defined(BOOST_ASIO_WINDOWS_APP) + HANDLE mutex = ::CreateMutexExW(0, mutex_name, CREATE_MUTEX_INITIAL_OWNER, 0); +#else // defined(BOOST_ASIO_WINDOWS_APP) HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); +#endif // defined(BOOST_ASIO_WINDOWS_APP) DWORD last_error = ::GetLastError(); if (mutex == 0) return ::GetLastError(); if (last_error == ERROR_ALREADY_EXISTS) + { +#if defined(BOOST_ASIO_WINDOWS_APP) + ::WaitForSingleObjectEx(mutex, INFINITE, false); +#else // defined(BOOST_ASIO_WINDOWS_APP) ::WaitForSingleObject(mutex, INFINITE); +#endif // defined(BOOST_ASIO_WINDOWS_APP) + } if (initialised_) { @@ -84,6 +94,14 @@ int win_static_mutex::do_init() { # if defined(UNDER_CE) ::InitializeCriticalSection(&crit_section_); +# elif defined(BOOST_ASIO_WINDOWS_APP) + if (!::InitializeCriticalSectionEx(&crit_section_, 0, 0)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } # else if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) { diff --git a/boost/asio/detail/impl/win_thread.ipp b/boost/asio/detail/impl/win_thread.ipp index 727c122e95..5ebd0e68a0 100644 --- a/boost/asio/detail/impl/win_thread.ipp +++ b/boost/asio/detail/impl/win_thread.ipp @@ -17,7 +17,9 @@ #include <boost/asio/detail/config.hpp> -#if defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#if defined(BOOST_ASIO_WINDOWS) \ + && !defined(BOOST_ASIO_WINDOWS_APP) \ + && !defined(UNDER_CE) #include <process.h> #include <boost/asio/detail/throw_error.hpp> @@ -57,7 +59,7 @@ void win_thread::join() void win_thread::start_thread(func_base* arg, unsigned int stack_size) { ::HANDLE entry_event = 0; - arg->entry_event_ = entry_event = ::CreateEvent(0, true, false, 0); + arg->entry_event_ = entry_event = ::CreateEventW(0, true, false, 0); if (!entry_event) { DWORD last_error = ::GetLastError(); @@ -67,7 +69,7 @@ void win_thread::start_thread(func_base* arg, unsigned int stack_size) boost::asio::detail::throw_error(ec, "thread.entry_event"); } - arg->exit_event_ = exit_event_ = ::CreateEvent(0, true, false, 0); + arg->exit_event_ = exit_event_ = ::CreateEventW(0, true, false, 0); if (!exit_event_) { DWORD last_error = ::GetLastError(); @@ -136,6 +138,8 @@ void __stdcall apc_function(ULONG_PTR) {} #include <boost/asio/detail/pop_options.hpp> -#endif // defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) +#endif // defined(BOOST_ASIO_WINDOWS) + // && !defined(BOOST_ASIO_WINDOWS_APP) + // && !defined(UNDER_CE) #endif // BOOST_ASIO_DETAIL_IMPL_WIN_THREAD_IPP |