summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-08 13:33:51 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-08 13:33:51 +0200
commit742528d17955425e5b920136eb4e8fc0c6d1bc82 (patch)
tree911fa124e6a50f94c3ba78f2a5cb8fef9910fc7c /source
parentedad17b52d6558a5559f02cddcb66158193fe164 (diff)
downloadkit-742528d17955425e5b920136eb4e8fc0c6d1bc82.zip
refactor allocs: win32
Diffstat (limited to 'source')
-rw-r--r--source/kit/thread.win32.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/source/kit/thread.win32.c b/source/kit/thread.win32.c
index c4b6f15..e7f84bf 100644
--- a/source/kit/thread.win32.c
+++ b/source/kit/thread.win32.c
@@ -65,10 +65,9 @@ Implementation limits:
*/
typedef struct {
- thrd_start_t func;
- void *arg;
- thrd_t thrd;
- kit_allocator_t alloc;
+ thrd_start_t func;
+ void *arg;
+ thrd_t thrd;
} impl_thrd_param_t;
struct thrd_state {
@@ -85,7 +84,7 @@ static unsigned __stdcall impl_thrd_routine(void *p) {
impl_current_thread.thrd = pack_p->thrd;
impl_current_thread.handle_need_close = false;
memcpy(&pack, pack_p, sizeof(impl_thrd_param_t));
- kit_alloc_dispatch(pack.alloc, KIT_DEALLOCATE, 0, 0, p);
+ kit_alloc_dispatch(NULL, KIT_DEALLOCATE, 0, 0, p);
code = pack.func(pack.arg);
return (unsigned) code;
}
@@ -273,20 +272,18 @@ int thrd_create_with_stack(thrd_t *thr, thrd_start_t func, void *arg,
uintptr_t handle;
assert(thr != NULL);
assert(stack_size >= 0 && stack_size < 0x100000000);
- kit_allocator_t alloc = kit_alloc_default();
pack = (impl_thrd_param_t *) kit_alloc_dispatch(
- alloc, KIT_ALLOCATE, (sizeof(impl_thrd_param_t)), 0, NULL);
+ NULL, KIT_ALLOCATE, (sizeof(impl_thrd_param_t)), 0, NULL);
if (!pack)
return thrd_nomem;
- pack->func = func;
- pack->arg = arg;
- pack->alloc = alloc;
- handle = _beginthreadex(NULL, (unsigned) stack_size,
- impl_thrd_routine, pack, CREATE_SUSPENDED,
- NULL);
+ pack->func = func;
+ pack->arg = arg;
+ handle = _beginthreadex(NULL, (unsigned) stack_size,
+ impl_thrd_routine, pack, CREATE_SUSPENDED,
+ NULL);
if (handle == 0) {
- kit_alloc_dispatch(alloc, KIT_DEALLOCATE, 0, 0, pack);
+ kit_alloc_dispatch(NULL, KIT_DEALLOCATE, 0, 0, pack);
if (errno == EAGAIN || errno == EACCES)
return thrd_nomem;
return thrd_error;