Skip to content

Commit

Permalink
gthr_aux,xglobals: Move gthread GUID definition
Browse files Browse the repository at this point in the history
  • Loading branch information
lhmouse committed Nov 26, 2024
1 parent fb3f1a5 commit f5f18df
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
7 changes: 2 additions & 5 deletions mcfgthread/gthr_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,6 @@ __MCF_gthr_cond_recursive_mutex_wait(_MCF_cond* cond, __MCF_gthr_rc_mutex* rmtx,
(intptr_t) rmtx, timeout_opt);
}

static __MCF_ALIGNED(16)
const GUID gthread_guid = __MCF_GUID(9FB2D15C,C5F2,4AE7,868D,2769591B8E92);

static
void
do_gthr_thread_thunk_v3(_MCF_thread* thrd)
Expand All @@ -322,7 +319,7 @@ do_gthr_get_thread_record(_MCF_thread* thrd)

/* Check the GUID. As user-defined data are aligned to 16-byte boundaries,
* there must be at least 16 bytes available. */
if(__builtin_memcmp(rec->__magic_guid, &gthread_guid, 16) != 0)
if(__builtin_memcmp(rec->__magic_guid, &__MCF_crt_gthread_guid, 16) != 0)
return __MCF_nullptr;

/* Assume so. `do_gthr_thread_thunk_v3()` is not shared across modules,
Expand All @@ -335,7 +332,7 @@ _MCF_thread*
__MCF_gthr_thread_create_v3(__MCF_gthr_thread_procedure* proc, void* arg)
{
__MCF_ALIGNED(16) __MCF_gthr_thread_record record;
__builtin_memcpy(record.__magic_guid, &gthread_guid, 16);
__builtin_memcpy(record.__magic_guid, &__MCF_crt_gthread_guid, 16);
record.__proc = proc;
record.__arg_or_result = arg;
return _MCF_thread_new(do_gthr_thread_thunk_v3, &record, sizeof(record));
Expand Down
1 change: 1 addition & 0 deletions mcfgthread/xglobals.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ static const PIMAGE_TLS_CALLBACK __MCF__xl_b __MCF__CRT_ALLOC(".CRT$XLB") = __MC

/* These are constants that have to be initialized at load time. The
* initializers prevent them from being placed into the`.bss` section. */
const GUID __MCF_crt_gthread_guid = __MCF_GUID(9FB2D15C,C5F2,4AE7,868D,2769591B8E92);
HANDLE __MCF_crt_heap = __MCF_BAD_PTR;
double __MCF_crt_pf_recip = 1;
SYSTEM_INFO __MCF_crt_sysinfo = { .dwPageSize = 1 };
Expand Down
1 change: 1 addition & 0 deletions mcfgthread/xglobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ struct __MCF_crt_xglobals
};

/* These are constants that have to be initialized at load time. */
extern const GUID __MCF_crt_gthread_guid;
extern SYSTEM_INFO __MCF_XGLOBALS_READONLY __MCF_crt_sysinfo;
extern HANDLE __MCF_XGLOBALS_READONLY __MCF_crt_heap;
extern double __MCF_XGLOBALS_READONLY __MCF_crt_pf_recip;
Expand Down

0 comments on commit f5f18df

Please sign in to comment.