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
1414
1515 uint32_t CSimpleTask::id = 0;
1616
17−void* OneCallingFunc() {
17+WELS_THREAD_ROUTINE_TYPE OneCallingFunc(void *) {
1818 CThreadPoolTest cThreadPoolTest;
1919 CSimpleTask* aTasks[TEST_TASK_NUM];
2020 CWelsThreadPool* pThreadPool = (CWelsThreadPool::AddReference());
@@ -44,7 +44,7 @@ void* OneCallingFunc() { · 23 unmodified lines
4444
4545
4646 TEST (CThreadPoolTest, CThreadPoolTest) {
47− OneCallingFunc();
47+ OneCallingFunc(NULL);
4848
4949 int iRet = CWelsThreadPool::SetThreadNum (8);
5050 EXPECT_EQ (0, iRet);
@@ -81,12 +81,12 @@ TEST (CThreadPoolTest, CThreadPoolTestMulti) { · 30 unmodified lines
8181 int i = 0;
8282 WELS_THREAD_ERROR_CODE rc;
8383 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);
8585 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
8686 WelsSleep (1);
8787 }
8888 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);
9090 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
9191 WelsSleep (1);
9292 WelsThreadJoin (mThreadID[i]);
@@ -95,7 +95,7 @@ TEST (CThreadPoolTest, CThreadPoolTestMulti) { · 2 unmodified lines
9595 WelsThreadJoin (mThreadID[i]);
9696 }
9797 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);
9999 ASSERT_TRUE (rc == WELS_THREAD_ERROR_OK);
100100 WelsSleep (1);
101101 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