fix thread start callback prototype for Open Watcom toolchain
fix callback prototype for Windows and pthread, the Windows version does not return any value and the pthread version is a standard thread callback function (THREAD_CB) with a return value fix callback function calling convention for Open Watcom toolchain Open Watcom has an implementation of _beginthread for other operating systems as well, and uses a default calling convention that is not cdecl
This commit is contained in:
parent
c8f56f035f
commit
f59f0f76da
@ -1229,7 +1229,7 @@ exit:
|
||||
}
|
||||
|
||||
#if !defined(SINGLE_THREADED) && defined(WOLFSSL_THREAD_NO_JOIN)
|
||||
static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN client_thread(void* args)
|
||||
static THREAD_RETURN_NOJOIN WOLFSSL_THREAD_NO_JOIN client_thread(void* args)
|
||||
{
|
||||
int ret;
|
||||
info_t* info = (info_t*)args;
|
||||
@ -1242,7 +1242,7 @@ static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN client_thread(void* args)
|
||||
THREAD_CHECK_RET(wolfSSL_CondSignal(&info->to_server.cond));
|
||||
THREAD_CHECK_RET(wolfSSL_CondEnd(&info->to_server.cond));
|
||||
|
||||
WOLFSSL_RETURN_FROM_THREAD(0);
|
||||
RETURN_FROM_THREAD_NOJOIN(0);
|
||||
}
|
||||
#endif /* !SINGLE_THREADED */
|
||||
#endif /* !NO_WOLFSSL_CLIENT */
|
||||
@ -1674,7 +1674,7 @@ exit:
|
||||
}
|
||||
|
||||
#if !defined(SINGLE_THREADED) && defined(WOLFSSL_THREAD_NO_JOIN)
|
||||
static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN server_thread(void* args)
|
||||
static THREAD_RETURN_NOJOIN WOLFSSL_THREAD_NO_JOIN server_thread(void* args)
|
||||
{
|
||||
int ret = 0;
|
||||
info_t* info = (info_t*)args;
|
||||
@ -1702,7 +1702,7 @@ static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN server_thread(void* args)
|
||||
THREAD_CHECK_RET(wolfSSL_CondSignal(&info->to_client.cond));
|
||||
THREAD_CHECK_RET(wolfSSL_CondEnd(&info->to_client.cond));
|
||||
|
||||
WOLFSSL_RETURN_FROM_THREAD(0);
|
||||
RETURN_FROM_THREAD_NOJOIN(0);
|
||||
}
|
||||
#endif /* !SINGLE_THREADED */
|
||||
#endif /* !NO_WOLFSSL_SERVER */
|
||||
|
@ -913,7 +913,7 @@ static WC_INLINE word64 Entropy_TimeHiRes(void)
|
||||
* @param [in,out] args Entropy data including: counter and stop flag.
|
||||
* @return NULL always.
|
||||
*/
|
||||
static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN Entropy_IncCounter(void* args)
|
||||
static THREAD_RETURN_NOJOIN WOLFSSL_THREAD_NO_JOIN Entropy_IncCounter(void* args)
|
||||
{
|
||||
(void)args;
|
||||
|
||||
@ -926,8 +926,8 @@ static THREAD_RETURN WOLFSSL_THREAD_NO_JOIN Entropy_IncCounter(void* args)
|
||||
#ifdef WOLFSSL_DEBUG_ENTROPY_MEMUSE
|
||||
fprintf(stderr, "EXITING ENTROPY COUNTER THREAD\n");
|
||||
#endif
|
||||
/* Exit from thread. */
|
||||
WOLFSSL_RETURN_FROM_THREAD(0);
|
||||
|
||||
RETURN_FROM_THREAD_NOJOIN(0);
|
||||
}
|
||||
|
||||
/* Start a thread that increments counter if not one already.
|
||||
|
@ -1550,7 +1550,11 @@ typedef struct w64wrapper {
|
||||
#define INVALID_THREAD_VAL ((THREAD_TYPE)(INVALID_HANDLE_VALUE))
|
||||
#define WOLFSSL_THREAD __stdcall
|
||||
#if !defined(__MINGW32__)
|
||||
#define WOLFSSL_THREAD_NO_JOIN __cdecl
|
||||
#if defined(__WATCOMC__)
|
||||
#define WOLFSSL_THREAD_NO_JOIN
|
||||
#else
|
||||
#define WOLFSSL_THREAD_NO_JOIN __cdecl
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
typedef unsigned int THREAD_RETURN;
|
||||
@ -1580,8 +1584,6 @@ typedef struct w64wrapper {
|
||||
* to check if the value is an invalid thread
|
||||
* WOLFSSL_THREAD - attribute that should be used to declare thread
|
||||
* callbacks
|
||||
* WOLFSSL_THREAD_NO_JOIN - attribute that should be used to declare
|
||||
* thread callbacks that don't require cleanup
|
||||
* WOLFSSL_COND - defined if this system supports signaling
|
||||
* COND_TYPE - type that should be passed into the signaling API
|
||||
* WOLFSSL_THREAD_VOID_RETURN - defined if the thread callback has a
|
||||
@ -1589,8 +1591,16 @@ typedef struct w64wrapper {
|
||||
* WOLFSSL_RETURN_FROM_THREAD - define used to correctly return from a
|
||||
* thread callback
|
||||
* THREAD_CB - thread callback type for regular threading API
|
||||
* THREAD_CB_NOJOIN - thread callback type for threading API that don't
|
||||
*
|
||||
* WOLFSSL_THREAD_NO_JOIN - attribute used to declare thread callbacks
|
||||
* that do not require cleanup
|
||||
* THREAD_CB_NOJOIN - thread callback type for thread APIs that do not
|
||||
* require cleanup
|
||||
* THREAD_RETURN_NOJOIN - return type used to declare thread callbacks
|
||||
* that do not require cleanup
|
||||
* RETURN_FROM_THREAD_NOJOIN - define used to correctly return from
|
||||
* a thread callback that do not require
|
||||
* cleanup
|
||||
*
|
||||
* Other defines/types are specific for the threading implementation
|
||||
*/
|
||||
@ -1613,8 +1623,16 @@ typedef struct w64wrapper {
|
||||
/* Create a thread that will be automatically cleaned up. We can't
|
||||
* return a handle/pointer to the new thread because there are no
|
||||
* guarantees for how long it will be valid. */
|
||||
typedef THREAD_RETURN (WOLFSSL_THREAD_NO_JOIN *THREAD_CB_NOJOIN)
|
||||
(void* arg);
|
||||
#if defined(WOLFSSL_PTHREADS)
|
||||
#define THREAD_CB_NOJOIN THREAD_CB
|
||||
#define THREAD_RETURN_NOJOIN THREAD_RETURN
|
||||
#define RETURN_FROM_THREAD_NOJOIN(x) WOLFSSL_RETURN_FROM_THREAD(x)
|
||||
#else
|
||||
#define THREAD_RETURN_NOJOIN void
|
||||
typedef THREAD_RETURN_NOJOIN
|
||||
(WOLFSSL_THREAD_NO_JOIN *THREAD_CB_NOJOIN)(void* arg);
|
||||
#define RETURN_FROM_THREAD_NOJOIN(x)
|
||||
#endif
|
||||
WOLFSSL_API int wolfSSL_NewThreadNoJoin(THREAD_CB_NOJOIN cb,
|
||||
void* arg);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user