mirror of https://gerrit.osmocom.org/gapk
procqueue: add human-readable name to osmo_gapk_pq
Since this change, every processing queue may optionally have an associated human-readable name. If name is not required, NULL should be passed to the osmo_gapk_pq_create().
This commit is contained in:
parent
262ae0f98f
commit
2286a36ace
|
@ -52,10 +52,13 @@ struct osmo_gapk_pq_item {
|
|||
struct osmo_gapk_pq {
|
||||
struct llist_head items;
|
||||
unsigned n_items;
|
||||
|
||||
/*! \brief human-readable name */
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* Processing queue management */
|
||||
struct osmo_gapk_pq *osmo_gapk_pq_create(void);
|
||||
struct osmo_gapk_pq *osmo_gapk_pq_create(const char *name);
|
||||
int osmo_gapk_pq_prepare(struct osmo_gapk_pq *pq);
|
||||
int osmo_gapk_pq_execute(struct osmo_gapk_pq *pq);
|
||||
void osmo_gapk_pq_destroy(struct osmo_gapk_pq *pq);
|
||||
|
|
|
@ -734,7 +734,7 @@ int main(int argc, char *argv[])
|
|||
return rv;
|
||||
|
||||
/* Create processing queue */
|
||||
gs->pq = osmo_gapk_pq_create();
|
||||
gs->pq = osmo_gapk_pq_create("main");
|
||||
if (!gs->pq) {
|
||||
rv = -ENOMEM;
|
||||
LOGP(DAPP, LOGL_ERROR, "Error creating processing queue\n");
|
||||
|
|
|
@ -32,7 +32,7 @@ extern TALLOC_CTX *gapk_root_ctx;
|
|||
|
||||
/* crate a new (empty) processing queue */
|
||||
struct osmo_gapk_pq *
|
||||
osmo_gapk_pq_create(void)
|
||||
osmo_gapk_pq_create(const char *name)
|
||||
{
|
||||
struct osmo_gapk_pq *pq;
|
||||
|
||||
|
@ -41,6 +41,13 @@ osmo_gapk_pq_create(void)
|
|||
if (!pq)
|
||||
return NULL;
|
||||
|
||||
if (name != NULL) {
|
||||
/* Rename talloc context */
|
||||
talloc_set_name(pq, "struct osmo_gapk_pq '%s'", name);
|
||||
/* Set queue name */
|
||||
pq->name = name;
|
||||
}
|
||||
|
||||
/* Init its list of items */
|
||||
INIT_LLIST_HEAD(&pq->items);
|
||||
|
||||
|
|
Loading…
Reference in New Issue