History

Use the right thread function signature in WealThreadPoolTest

This fixes warnings when built with clang for i686, warning about casting between cdecl and stdcall - which normally can be fatal. This avoids needing to use casts when passing the function to WelsThreadCreate across all platforms.

Martin Storsjö committed 6 years ago

Commit fb5e5081 parent 234f7091 file · +5 −5Browse files

Showing the changes to test/common/WelsThreadPoolTest.cpp (1 of 1 file). Show all

Unified · Split

test/common/WelsThreadPoolTest.cpp+5−5
@@ -14,7 +14,7 @@ · 13 unmodified lines
14 14
15uint32_t CSimpleTask::id = 0;15uint32_t CSimpleTask::id = 0;
16 16
17void* OneCallingFunc() {17WELS_THREAD_ROUTINE_TYPE OneCallingFunc(void *) {
18 CThreadPoolTest cThreadPoolTest;18 CThreadPoolTest cThreadPoolTest;
19 CSimpleTask* aTasks[TEST_TASK_NUM];19 CSimpleTask* aTasks[TEST_TASK_NUM];
20 CWelsThreadPool* pThreadPool = (CWelsThreadPool::AddReference());20 CWelsThreadPool* pThreadPool = (CWelsThreadPool::AddReference());
@@ -44,7 +44,7 @@ void* OneCallingFunc() { · 23 unmodified lines
44 44
45 45
46TEST (CThreadPoolTest, CThreadPoolTest) {46TEST (CThreadPoolTest, CThreadPoolTest) {
47 OneCallingFunc();47 OneCallingFunc(NULL);
48 48
49 int iRet = CWelsThreadPool::SetThreadNum (8);49 int iRet = CWelsThreadPool::SetThreadNum (8);
50 EXPECT_EQ (0, iRet);50 EXPECT_EQ (0, iRet);
@@ -81,12 +81,12 @@ TEST (CThreadPoolTest, CThreadPoolTestMulti) { · 30 unmodified lines
81 int i = 0;81 int i = 0;
82 WELS_THREAD_ERROR_CODE rc;82 WELS_THREAD_ERROR_CODE rc;
83 for (i = 0; i < iCallingNum; i++) {83 for (i = 0; i < iCallingNum; i++) {
84 rc = WelsThreadCreate (& (mThreadID[i]), (LPWELS_THREAD_ROUTINE)OneCallingFunc, NULL, 0);84 rc = WelsThreadCreate (& (mThreadID[i]), OneCallingFunc, NULL, 0);
85 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);85 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
86 WelsSleep (1);86 WelsSleep (1);
87 }87 }
88 for (i = iCallingNum; i < iCallingNum * 2; i++) {88 for (i = iCallingNum; i < iCallingNum * 2; i++) {
89 rc = WelsThreadCreate (& (mThreadID[i]), (LPWELS_THREAD_ROUTINE)OneCallingFunc, NULL, 0);89 rc = WelsThreadCreate (& (mThreadID[i]), OneCallingFunc, NULL, 0);
90 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);90 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
91 WelsSleep (1);91 WelsSleep (1);
92 WelsThreadJoin (mThreadID[i]);92 WelsThreadJoin (mThreadID[i]);
@@ -95,7 +95,7 @@ TEST (CThreadPoolTest, CThreadPoolTestMulti) { · 2 unmodified lines
95 WelsThreadJoin (mThreadID[i]);95 WelsThreadJoin (mThreadID[i]);
96 }96 }
97 for (i = iCallingNum * 2; i < iCallingNum * 3; i++) {97 for (i = iCallingNum * 2; i < iCallingNum * 3; i++) {
98 rc = WelsThreadCreate (& (mThreadID[i]), (LPWELS_THREAD_ROUTINE)OneCallingFunc, NULL, 0);98 rc = WelsThreadCreate (& (mThreadID[i]), OneCallingFunc, NULL, 0);
99 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);99 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
100 WelsSleep (1);100 WelsSleep (1);
101 WelsThreadJoin (mThreadID[i]);101 WelsThreadJoin (mThreadID[i]);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t