win32 native threading vs pthreads on mingw-w64

also, msc++ implements all of C++17
pull/14/head
despair86 6 years ago
parent 806e9f82a3
commit 23ecd03c71

@ -48,7 +48,7 @@ namespace llarp
void
HandleDataMessage(service::ProtocolMessage* msg);
#ifndef _WIN32
#ifndef _MINGW32_NO_THREADS
/// overrides Endpount
bool
IsolationFailed()
@ -101,7 +101,7 @@ namespace llarp
FlushSend();
private:
#ifndef _WIN32
#ifndef _MINGW32_NO_THREADS
/// handles setup, given value true on success and false on failure to set
/// up interface
std::promise< bool > m_TunSetupResult;

@ -2,6 +2,7 @@
#define LLARP_THREADING_HPP
#include <mutex>
#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
#define _MINGW32_NO_THREADS
#include <llarp/win32/threads/mingw.condition_variable.h>
#include <llarp/win32/threads/mingw.mutex.h>
#include <llarp/win32/threads/mingw.thread.h>

@ -108,7 +108,7 @@ namespace llarp
// do network isolation first
if(!Endpoint::Start())
return false;
#ifdef _WIN32
#ifdef _MINGW32_NO_THREADS
return SetupNetworking();
#else
if(!NetworkIsIsolated())

@ -533,7 +533,9 @@ SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
GetModuleHandle("kernel32"), "SetThreadDescription");
if(_SetThreadDescription)
{
/* grab another reference to the thread */
hThread = OpenThread(THREAD_SET_LIMITED_INFORMATION, FALSE, dwThreadID);
/* windows takes unicode, our input is utf-8 or plain ascii */
MultiByteToWideChar(CP_ACP, 0, szThreadName, -1, thr_name_w, 16);
if(hThread)
_SetThreadDescription(hThread, thr_name_w);
@ -559,6 +561,7 @@ SetThreadName(DWORD dwThreadID, LPCSTR szThreadName)
{
}
}
/* clean up */
if(hThread)
CloseHandle(hThread);
}

Loading…
Cancel
Save