Give node_subreq a pointer to the lock used with the condition variable

mostly to have it available in tree_free / tree_prune later
parent 0fd464be
......@@ -715,12 +715,12 @@ push_subreq(struct req *req, struct bytes_tree *tree,
(void) next;
if (node->subreq.done == 0) {
Lck_Lock(&tree->tree_lock);
Lck_Lock(node->subreq.shared_lock);
if (node->subreq.done == 0)
AZ(Lck_CondWait(
&node->subreq.cond,
&tree->tree_lock));
Lck_Unlock(&tree->tree_lock);
node->subreq.shared_lock));
Lck_Unlock(node->subreq.shared_lock);
}
subreq = subreq_fixup(node, req);
......
......@@ -154,9 +154,10 @@ struct node_subreq {
struct boc *boc;
// oc is NULL if already transferred back into req
struct objcore *oc;
struct lock *shared_lock; // == &tree->tree_lock
pthread_cond_t cond;
// subreq to topreq delivery
int done;
pthread_cond_t cond;
};
// sub-state for node_final while in ST_DATA
......
......@@ -1456,8 +1456,11 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
HSH_Ref(req->objcore);
node->subreq.oc = req->objcore;
node->subreq.shared_lock = &tree->tree_lock;
AZ(pthread_cond_init(&node->subreq.cond, NULL));
AZ(node->subreq.done);
node_mutate_lock(tree, node, T_SUBREQ, ST_DATA);
node_mutate_unlock(tree);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment