Skip to content

Commit 708b14e

Browse files
committed
🛠 __self_handle/__self_thread mispelling
1 parent 75ab75d commit 708b14e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

source/ztd/thread/threads.pthreads.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,14 @@ inline static void* __ztdc_pthread_trampoline(void* __userdata) {
402402
// the __name array...
403403
#if ZTD_IS_ON(ZTD_C_STDLIB_BSD) && ZTD_IS_ON(ZTD_PLATFORM_NET_BSD)
404404
__pre_err = __ztdc_pthread_to_thread_error(pthread_setname_np(
405-
__self_thread, __trampoline_userdata->__name, NULL)); // name + void* arg -- huh??
405+
__self_handle, __trampoline_userdata->__name, NULL)); // name + void* arg -- huh??
406406
#elif ZTD_IS_ON(ZTD_C_STDLIB_BSD) && (ZTD_IS_ON(ZTD_PLATFORM_FREE_BSD) || ZTD_IS_ON(ZTD_PLATFORM_OPEN_BSD))
407407
// same as most other *nix but different spelling
408-
pthread_set_name_np(__self_thread, __trampoline_userdata->__name);
408+
pthread_set_name_np(__self_handle, __trampoline_userdata->__name);
409409
#else
410410
// everyone else is mildly normal about this.
411411
__pre_err
412-
= __ztdc_pthread_to_thread_error(pthread_setname_np(__self_thread, __trampoline_userdata->__name));
412+
= __ztdc_pthread_to_thread_error(pthread_setname_np(__self_handle, __trampoline_userdata->__name));
413413
#endif
414414
#endif
415415
}

source/ztd/thread/threads.windows.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ typedef struct __ztdc_win32thread_trampoline_t {
218218
inline static DWORD __ztdc_win32thread_trampoline(LPVOID __userdata) {
219219
ztdc_static_assert(
220220
sizeof(DWORD) >= sizeof(int), "size of `int` is too large for a `DWORD`: trampoline will not work");
221+
DWORD __win32_res = 0;
221222
thrd_t* __thr = NULL;
222223
thrd_start_t __func = NULL;
223224
void* __func_arg = NULL;
@@ -249,16 +250,22 @@ inline static DWORD __ztdc_win32thread_trampoline(LPVOID __userdata) {
249250
// wait for feedback for this error.
250251
}
251252
if (*__sync_result != thrd_success) {
252-
return 0;
253+
return __win32_res;
253254
}
254255
}
255256
atomic_store(__sync_until, false);
256257
}
258+
atomic_store(__sync_until, false);
259+
while (atomic_load(__sync_still_ok)) {
260+
// wait for feedback for on whether or not a potential custom_on_origin has finished.
261+
}
262+
if (*__sync_result != thrd_success) {
263+
return __win32_res;
264+
}
257265
if (!__func) {
258-
return 0;
266+
return __win32_res;
259267
}
260-
DWORD __win32_res = 0;
261-
__win32_res = __func(__func_arg);
268+
__win32_res = __func(__func_arg);
262269
return __win32_res;
263270
}
264271

0 commit comments

Comments
 (0)