minor tweak
This commit is contained in:
parent
2d593fee03
commit
aaad37da27
@ -4,10 +4,10 @@
|
|||||||
#include "atomic.h"
|
#include "atomic.h"
|
||||||
#include "intrinsics.h"
|
#include "intrinsics.h"
|
||||||
|
|
||||||
#define THREAD_LOCAL_TABLE_RESERVE (MEGABYTE(1))
|
#define THREAD_LOCAL_STORE_RESERVE (MEGABYTE(64))
|
||||||
|
|
||||||
/* Arbitrary. Increase if needed. */
|
/* Arbitrary. Increase if needed. */
|
||||||
#define MAX_THREAD_LOCAL_VARS 64
|
#define MAX_THREAD_LOCAL_VARS 256
|
||||||
|
|
||||||
GLOBAL struct {
|
GLOBAL struct {
|
||||||
struct atomic_i64 metas_lock_flag;
|
struct atomic_i64 metas_lock_flag;
|
||||||
@ -32,7 +32,7 @@ struct thread_local_store thread_local_store_alloc(void)
|
|||||||
{
|
{
|
||||||
__prof;
|
__prof;
|
||||||
struct thread_local_store t = { 0 };
|
struct thread_local_store t = { 0 };
|
||||||
t.arena = arena_alloc(THREAD_LOCAL_TABLE_RESERVE);
|
t.arena = arena_alloc(THREAD_LOCAL_STORE_RESERVE);
|
||||||
t.lookup = arena_push_array_zero(&t.arena, void *, MAX_THREAD_LOCAL_VARS);
|
t.lookup = arena_push_array_zero(&t.arena, void *, MAX_THREAD_LOCAL_VARS);
|
||||||
t.allocation_order = arena_push_array_zero(&t.arena, u64, MAX_THREAD_LOCAL_VARS);
|
t.allocation_order = arena_push_array_zero(&t.arena, u64, MAX_THREAD_LOCAL_VARS);
|
||||||
return t;
|
return t;
|
||||||
|
|||||||
@ -447,9 +447,9 @@ INTERNAL struct work_handle work_push_from_slate_assume_locked(struct work_slate
|
|||||||
*/
|
*/
|
||||||
struct worker_ctx *ctx = thread_local_eval(&tl_worker_ctx);
|
struct worker_ctx *ctx = thread_local_eval(&tl_worker_ctx);
|
||||||
if (ctx->is_worker) {
|
if (ctx->is_worker) {
|
||||||
b32 more_tasks = true;
|
b32 work_done = false;
|
||||||
while (G.idle_worker_count == 0 && work->workers == 0 && more_tasks) {
|
while (!work_done && G.idle_worker_count == 0 && work->workers == 0) {
|
||||||
more_tasks = work_exec_single_task_maybe_release_assume_locked(work);
|
work_done = !work_exec_single_task_maybe_release_assume_locked(work);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user