提交 61789426 创建 作者: Austin Clements's avatar Austin Clements

Assert if work queues are used too early

上级 38fd95b5
...@@ -30,12 +30,14 @@ wq_size(void) ...@@ -30,12 +30,14 @@ wq_size(void)
int int
wq_push(work *w) wq_push(work *w)
{ {
assert(wq_);
return wq_->push(w, mycpuid()); return wq_->push(w, mycpuid());
} }
void void
wqcrit_trywork(void) wqcrit_trywork(void)
{ {
assert(wqcrit_);
while (wqcrit_->trywork(false)) while (wqcrit_->trywork(false))
; ;
} }
...@@ -43,19 +45,22 @@ wqcrit_trywork(void) ...@@ -43,19 +45,22 @@ wqcrit_trywork(void)
int int
wqcrit_push(work *w, int c) wqcrit_push(work *w, int c)
{ {
assert(wqcrit_);
return wqcrit_->push(w, c); return wqcrit_->push(w, c);
} }
int int
wq_trywork(void) wq_trywork(void)
{ {
assert(wq_ && wqcrit_);
return wqcrit_->trywork(false) || wq_->trywork(true); return wqcrit_->trywork(false) || wq_->trywork(true);
} }
void void
wq_dump(void) wq_dump(void)
{ {
return wq_->dump(); if (wq_)
return wq_->dump();
} }
void void
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论