Skip to content

Commit

Permalink
Removed: threadpool asserts when calling to system function
Browse files Browse the repository at this point in the history
  • Loading branch information
richardbiely committed Oct 25, 2023
1 parent 7d2cb2b commit 9de49ab
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions include/gaia/mt/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ namespace gaia {
auto nativeHandle = (HANDLE)m_workers[threadID].native_handle();

auto mask = SetThreadAffinityMask(nativeHandle, 1ULL << threadID);
GAIA_ASSERT(mask > 0);
if (mask <= 0)
GAIA_LOG_W("Issue setting thread affinity for worker thread %u!", threadID);
#elif GAIA_PLATFORM_APPLE
Expand All @@ -301,7 +300,6 @@ namespace gaia {
thread_affinity_policy_data_t policy_data = {(int)threadID};
auto ret = thread_policy_set(
mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy_data, THREAD_AFFINITY_POLICY_COUNT);
GAIA_ASSERT(ret != 0);
if (ret == 0)
GAIA_LOG_W("Issue setting thread affinity for worker thread %u!", threadID);
#elif GAIA_PLATFORM_LINUX || GAIA_PLATFORM_FREEBSD
Expand All @@ -312,12 +310,10 @@ namespace gaia {
CPU_SET(threadID, &cpuset);

auto ret = pthread_setaffinity_np(nativeHandle, sizeof(cpuset), &cpuset);
GAIA_ASSERT(ret == 0);
if (ret != 0)
GAIA_LOG_W("Issue setting thread affinity for worker thread %u!", threadID);

ret = pthread_getaffinity_np(nativeHandle, sizeof(cpuset), &cpuset);
GAIA_ASSERT(ret == 0);
if (ret != 0)
GAIA_LOG_W("Thread affinity could not be set for worker thread %u!", threadID);
#endif
Expand All @@ -330,14 +326,12 @@ namespace gaia {
wchar_t threadName[10]{};
swprintf_s(threadName, L"worker_%u", threadID);
auto hr = SetThreadDescription(nativeHandle, threadName);
GAIA_ASSERT(SUCCEEDED(hr));
if (FAILED(hr))
GAIA_LOG_W("Issue setting worker thread name!");
#elif GAIA_PLATFORM_APPLE
char threadName[10]{};
snprintf(threadName, 10, "worker_%u", threadID);
auto ret = pthread_setname_np(threadName);
GAIA_ASSERT(ret == 0);
if (ret != 0)
GAIA_LOG_W("Issue setting name for worker thread %u!", threadID);
#elif GAIA_PLATFORM_LINUX || GAIA_PLATFORM_FREEBSD
Expand All @@ -346,7 +340,6 @@ namespace gaia {
char threadName[10]{};
snprintf(threadName, 10, "worker_%u", threadID);
auto ret = pthread_setname_np(nativeHandle, threadName);
GAIA_ASSERT(ret == 0);
if (ret != 0)
GAIA_LOG_W("Issue setting name for worker thread %u!", threadID);
#endif
Expand Down

0 comments on commit 9de49ab

Please sign in to comment.