save works
This commit is contained in:
parent
acfbec875b
commit
3f74f14687
38 changed files with 751 additions and 448 deletions
|
|
@ -55,7 +55,14 @@ int queue_ctrl(cluster_t* c, xce_queuectrl_t* ctrl)
|
|||
return -EINVAL;
|
||||
}
|
||||
TRACE("%s queue_ctrl queue %s", __func__, ctrl->queue);
|
||||
|
||||
lock(c->qmgr, RTTI_LOCK_READ);
|
||||
rc = key_find(c->qmgr, (void*)ctrl->queue, (void**)&q);
|
||||
if (q != NULL) {
|
||||
reference(q);
|
||||
}
|
||||
unlock(c->qmgr);
|
||||
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -65,6 +72,7 @@ int queue_ctrl(cluster_t* c, xce_queuectrl_t* ctrl)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
lock(q, RTTI_LOCK_WRITE);
|
||||
switch (ctrl->action) {
|
||||
case QUEUE_OPEN:
|
||||
if (!(q->queue.status & QUEUE_STAT_CLOSED)) {
|
||||
|
|
@ -98,7 +106,12 @@ int queue_ctrl(cluster_t* c, xce_queuectrl_t* ctrl)
|
|||
xce_run_hooks(&(c->hooksys), XCE_CONTROLLER_HOOK_QUEUE,
|
||||
HOOK_AFTER_EVENT, HOOK_DETAIL_QUEUE_UPDATE, c, q);
|
||||
}
|
||||
|
||||
clean:
|
||||
unlock(q);
|
||||
|
||||
dereference(q);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +144,13 @@ int get_queue_exec(cluster_t* c, char* queue, char** pre_exec, char** post_exec)
|
|||
|
||||
TRACE("%s queue %s", __func__, queue);
|
||||
|
||||
lock(c->qmgr, RTTI_LOCK_READ);
|
||||
rc = key_find(c->qmgr, (void*)queue, (void**)&q);
|
||||
if (q != NULL) {
|
||||
reference(q);
|
||||
}
|
||||
unlock(c->qmgr);
|
||||
|
||||
if (rc < 0) {
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -141,6 +160,7 @@ int get_queue_exec(cluster_t* c, char* queue, char** pre_exec, char** post_exec)
|
|||
return -ENOENT;
|
||||
}
|
||||
|
||||
lock(q, RTTI_LOCK_READ);
|
||||
if (q->queue.pre_exec != NULL) {
|
||||
*pre_exec = makeString(q->queue.pre_exec);
|
||||
} else {
|
||||
|
|
@ -152,6 +172,9 @@ int get_queue_exec(cluster_t* c, char* queue, char** pre_exec, char** post_exec)
|
|||
} else {
|
||||
*post_exec = NULL;
|
||||
}
|
||||
unlock(q);
|
||||
|
||||
dereference(q);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue