mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added a couple of states to the path FSM
This commit is contained in:
parent
bad1dc953a
commit
69a16b2ac7
2 changed files with 10 additions and 4 deletions
|
@ -35,9 +35,11 @@ struct path
|
|||
{
|
||||
enum {
|
||||
PATH_INVALID, /**< Path is invalid. */
|
||||
PATH_CREATED, /**< Path has been created. */
|
||||
PATH_CREATED, /**< Path has been created: lists initialized */
|
||||
PATH_INITIALIZED, /**< Path queues, memory pools & hook system initialized. */
|
||||
PATH_RUNNING, /**< Path is currently running. */
|
||||
PATH_STOPPED /**< Path has been stopped. */
|
||||
PATH_STOPPED, /**< Path has been stopped. */
|
||||
PATH_DESTROYED /**< Path is destroyed. */
|
||||
} state; /**< Path state */
|
||||
|
||||
struct node *in; /**< Pointer to the incoming node */
|
||||
|
|
|
@ -120,11 +120,11 @@ int path_stop(struct path *p)
|
|||
pthread_cancel(p->recv_tid);
|
||||
pthread_join(p->recv_tid, NULL);
|
||||
|
||||
p->state = PATH_STOPPED;
|
||||
|
||||
if (hook_run(p, NULL, 0, HOOK_PATH_STOP))
|
||||
return -1;
|
||||
|
||||
p->state = PATH_STOPPED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -179,6 +179,8 @@ int path_prepare(struct path *p)
|
|||
ret = queue_init(&p->queue, p->queuelen, &memtype_hugepage);
|
||||
if (ret)
|
||||
error("Failed to initialize queue for path");
|
||||
|
||||
p->state = PATH_INITIALIZED;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -192,6 +194,8 @@ void path_destroy(struct path *p)
|
|||
|
||||
queue_destroy(&p->queue);
|
||||
pool_destroy(&p->pool);
|
||||
|
||||
p->state = PATH_DESTROYED;
|
||||
|
||||
free(p->_name);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue