Oops, forgot to init wqalloc blocks

上级 e7be4f53
...@@ -50,3 +50,10 @@ wqfree(void *ptr) ...@@ -50,3 +50,10 @@ wqfree(void *ptr)
b->next = *block; b->next = *block;
*block = b; *block = b;
} }
void
wqallocinit(void)
{
for (int i = 0; i < NCPU; i++)
block[i] = nullptr;
}
...@@ -83,12 +83,16 @@ xfreework(void* ptr, unsigned long nbytes) ...@@ -83,12 +83,16 @@ xfreework(void* ptr, unsigned long nbytes)
void void
initwq(void) initwq(void)
{ {
extern void wqallocinit(void);
if (pthread_key_create(&idkey, 0)) if (pthread_key_create(&idkey, 0))
die("wqarch_init: pthread_key_create"); die("wqarch_init: pthread_key_create");
int id = nextid++; int id = nextid++;
pthread_setspecific(idkey, (void*)(u64)id); pthread_setspecific(idkey, (void*)(u64)id);
wqallocinit();
wq_ = new wq(); wq_ = new wq();
if (wq_ == nullptr) if (wq_ == nullptr)
die("initwq"); die("initwq");
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论