mirror of https://github.com/wolfSSL/wolfssh.git
Test Threading
1. Whitespace. 2. Rename the Threading case for "else" to "elif defined(USE_WINDOWS_API)" and added a new else case.pull/474/head
parent
15c0fd5d18
commit
c4b2af1a79
|
@ -853,20 +853,25 @@ static INLINE void ThreadStart(THREAD_FUNC fun, void* args, THREAD_TYPE* thread)
|
||||||
#else
|
#else
|
||||||
pthread_create(thread, 0, fun, args);
|
pthread_create(thread, 0, fun, args);
|
||||||
#endif
|
#endif
|
||||||
return;
|
|
||||||
#elif defined(WOLFSSL_TIRTOS)
|
#elif defined(WOLFSSL_TIRTOS)
|
||||||
/* Initialize the defaults and set the parameters. */
|
{
|
||||||
Task_Params taskParams;
|
/* Initialize the defaults and set the parameters. */
|
||||||
Task_Params_init(&taskParams);
|
Task_Params taskParams;
|
||||||
taskParams.arg0 = (UArg)args;
|
Task_Params_init(&taskParams);
|
||||||
taskParams.stackSize = 65535;
|
taskParams.arg0 = (UArg)args;
|
||||||
*thread = Task_create((Task_FuncPtr)fun, &taskParams, NULL);
|
taskParams.stackSize = 65535;
|
||||||
if (*thread == NULL) {
|
*thread = Task_create((Task_FuncPtr)fun, &taskParams, NULL);
|
||||||
printf("Failed to create new Task\n");
|
if (*thread == NULL) {
|
||||||
|
printf("Failed to create new Task\n");
|
||||||
|
}
|
||||||
|
Task_yield();
|
||||||
}
|
}
|
||||||
Task_yield();
|
#elif defined(USE_WINDOWS_API)
|
||||||
#else
|
|
||||||
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
|
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
|
||||||
|
#else
|
||||||
|
(void)fun;
|
||||||
|
(void)args;
|
||||||
|
(void)thread;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,12 +890,16 @@ static INLINE void ThreadJoin(THREAD_TYPE thread)
|
||||||
}
|
}
|
||||||
Task_yield();
|
Task_yield();
|
||||||
}
|
}
|
||||||
|
#elif defined(USE_WINDOWS_API)
|
||||||
|
{
|
||||||
|
int res = WaitForSingleObject((HANDLE)thread, INFINITE);
|
||||||
|
assert(res == WAIT_OBJECT_0);
|
||||||
|
res = CloseHandle((HANDLE)thread);
|
||||||
|
assert(res);
|
||||||
|
(void)res; /* Suppress un-used variable warning */
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int res = WaitForSingleObject((HANDLE)thread, INFINITE);
|
(void)thread;
|
||||||
assert(res == WAIT_OBJECT_0);
|
|
||||||
res = CloseHandle((HANDLE)thread);
|
|
||||||
assert(res);
|
|
||||||
(void)res; /* Suppress un-used variable warning */
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -911,10 +920,14 @@ static INLINE void ThreadDetach(THREAD_TYPE thread)
|
||||||
Task_yield();
|
Task_yield();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(USE_WINDOWS_API)
|
||||||
|
{
|
||||||
|
int res = CloseHandle((HANDLE)thread);
|
||||||
|
assert(res);
|
||||||
|
(void)res; /* Suppress un-used variable warning */
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int res = CloseHandle((HANDLE)thread);
|
(void)thread;
|
||||||
assert(res);
|
|
||||||
(void)res; /* Suppress un-used variable warning */
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue