Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[winpr,pool] make Callback Environment API functions #8871

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 6 additions & 26 deletions winpr/include/winpr/pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,37 +242,17 @@ extern "C"
#define WINPR_CALLBACK_ENVIRON 1
#endif

#ifdef WINPR_CALLBACK_ENVIRON
#if defined(WINPR_CALLBACK_ENVIRON)
/* some version of mingw are missing Callback Environment functions */

/* Callback Environment */

static INLINE VOID InitializeThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe)
{
const TP_CALLBACK_ENVIRON empty = { 0 };
*pcbe = empty;
pcbe->Version = 1;
}

static INLINE VOID DestroyThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe)
{
/* no actions, this may change in a future release. */
}

static INLINE VOID SetThreadpoolCallbackPool(PTP_CALLBACK_ENVIRON pcbe, PTP_POOL ptpp)
{
pcbe->Pool = ptpp;
}

static INLINE VOID SetThreadpoolCallbackRunsLong(PTP_CALLBACK_ENVIRON pcbe)
{
pcbe->u.s.LongFunction = 1;
}
WINPR_API VOID InitializeThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe);
WINPR_API VOID DestroyThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe);
WINPR_API VOID SetThreadpoolCallbackPool(PTP_CALLBACK_ENVIRON pcbe, PTP_POOL ptpp);
WINPR_API VOID SetThreadpoolCallbackRunsLong(PTP_CALLBACK_ENVIRON pcbe);
WINPR_API VOID SetThreadpoolCallbackLibrary(PTP_CALLBACK_ENVIRON pcbe, PVOID mod);

static INLINE VOID SetThreadpoolCallbackLibrary(PTP_CALLBACK_ENVIRON pcbe, PVOID mod)
{
pcbe->RaceDll = mod;
}
#endif

#ifdef __cplusplus
Expand Down
36 changes: 36 additions & 0 deletions winpr/libwinpr/pool/callback_cleanup.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,39 @@ VOID DisassociateCurrentThreadFromCallback(PTP_CALLBACK_INSTANCE pci)
}

#endif /* WINPR_THREAD_POOL defined */

#if defined(WINPR_CALLBACK_ENVIRON)
VOID InitializeThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe)
{
const TP_CALLBACK_ENVIRON empty = { 0 };
WINPR_ASSERT(pcbe);

*pcbe = empty;
pcbe->Version = 1;
}

VOID DestroyThreadpoolEnvironment(PTP_CALLBACK_ENVIRON pcbe)
{
/* no actions, this may change in a future release. */
WINPR_UNUSED(pcbe);
}

VOID SetThreadpoolCallbackPool(PTP_CALLBACK_ENVIRON pcbe, PTP_POOL ptpp)
{
WINPR_ASSERT(pcbe);
pcbe->Pool = ptpp;
}

VOID SetThreadpoolCallbackRunsLong(PTP_CALLBACK_ENVIRON pcbe)
{
WINPR_ASSERT(pcbe);
pcbe->u.s.LongFunction = 1;
}

VOID SetThreadpoolCallbackLibrary(PTP_CALLBACK_ENVIRON pcbe, PVOID mod)
{
WINPR_ASSERT(pcbe);
pcbe->RaceDll = mod;
}

#endif