PadicoTM Task Engine. More...
#include <unistd.h>#include <Padico/Puk.h>#include <Padico/Module.h>#include "PM2.h"#include "TaskManager-internals.h"
Go to the source code of this file.
Data Structures | |
| struct | padico_tasklet_s |
| a tasklet descriptor More... | |
Macros | |
| #define | PADICO_TASKLET_OWNER_NULL ((marcel_t)0x0) |
Variables | ||
| struct puk_mod_binary_s | padico_mod_binary__PadicoTM | |
| padico_tasklet_action | ||
| an action item for a tasklet | ||
| padico_tasklet_t | tasklet | |
| void * | data { struct ns_rulebucket_hash_entry_s*e = ns_rulebucket_hash_entry_lookup(h, key) | |
| place-holder for actual data | ||
| padico_event_listener_t | listener | |
| int * | listener_num | |
| char * | name | |
| typdef struct padico_event_listener_vect_s * | padico_event_listener_vect_t | |
| struct { | ||
| padico_tasklet_t tasks | ||
| padico_req_id_t next_req_id | ||
| marcel_mutex_t req_lock | ||
| marcel_cond_t req_finished | ||
| struct padico_req_list_s reqs | ||
| marcel_mutex_t main_lock | ||
| marcel_cond_t main_cond | ||
| padico_task_t main_task | ||
| marcel_key_t current_tasklet | ||
| } | te | |
Detailed Description
PadicoTM Task Engine.
Definition in file tm-taskengine.c.
Macro Definition Documentation
◆ PADICO_TASKLET_OWNER_NULL
Definition at line 50 of file tm-taskengine.c.
Function Documentation
◆ padico_module_import_initializer__PadicoTM()
Definition at line 38 of file tm-taskengine.c.
◆ padico_tasklet_acquire()
| void padico_tasklet_acquire | ( | padico_tasklet_t | t | ) |
acquire tasklet ownership for the current thread
Definition at line 576 of file tm-taskengine.c.
References assert(), padico_tasklet_s::level, padico_tasklet_s::list_event, padico_tasklet_s::lock, padico_tasklet_s::name, padico_tasklet_s::owner, and PADICO_TASKLET_OWNER_NULL.
Referenced by padico_control_event_disable(), padico_control_finalize(), padico_control_init(), padico_tasklet_destroy(), and padico_tm_task_engine_init().
◆ padico_tasklet_destroy()
| void padico_tasklet_destroy | ( | padico_tasklet_t | t | ) |
Stop and destroy a tasklet.
Definition at line 494 of file tm-taskengine.c.
References padico_tasklet_s::actions, assert(), padico_tasklet_s::list_event, padico_tasklet_s::lock, padico_tasklet_s::name, NULL, padico_tasklet_acquire(), padico_tasklet_flush(), padico_tasklet_release(), padico_tasklet_s::running, padico_tasklet_s::subscribers, and padico_tasklet_s::worker.
Referenced by padico_control_finalize(), and padico_tm_task_engine_finalize().
◆ padico_tasklet_dispatch()
|
inlinestatic |
dispatch the next ready action in the tasklet
- Precondition
- tasklet lock not held by calling function
- tasklet owned by thread
Definition at line 390 of file tm-taskengine.c.
References a, padico_tasklet_s::actions, assert(), padico_tasklet_s::level, padico_tasklet_s::lock, padico_tasklet_s::owner, and tasklet.
Referenced by padico_tasklet_flush(), padico_tasklet_worker(), and padico_tm_req_wait().
◆ padico_tasklet_flush()
| void padico_tasklet_flush | ( | padico_tasklet_t | t | ) |
Definition at line 611 of file tm-taskengine.c.
References padico_tasklet_s::actions, padico_tasklet_s::name, and padico_tasklet_dispatch().
Referenced by padico_control_event_flush(), and padico_tasklet_destroy().
◆ padico_tasklet_new()
| padico_tasklet_t padico_tasklet_new | ( | const char * | name | ) |
Create a new tasklet.
Definition at line 479 of file tm-taskengine.c.
References padico_tasklet_s::actions, padico_tasklet_s::level, padico_tasklet_s::list_event, padico_tasklet_s::lock, name, padico_tasklet_s::name, NULL, padico_tasklet_s::owner, PADICO_TASKLET_OWNER_NULL, padico_tasklet_worker(), padico_tasklet_s::running, padico_tasklet_s::subscribers, and padico_tasklet_s::worker.
Referenced by padico_control_init(), and padico_tm_task_engine_init().
◆ padico_tasklet_release()
| void padico_tasklet_release | ( | padico_tasklet_t | t | ) |
release tasklet ownership from the current thread
Definition at line 592 of file tm-taskengine.c.
References assert(), padico_tasklet_s::level, padico_tasklet_s::list_event, padico_tasklet_s::lock, padico_tasklet_s::name, padico_tasklet_s::owner, and PADICO_TASKLET_OWNER_NULL.
Referenced by padico_control_event_enable(), padico_control_finalize(), padico_control_init(), padico_tasklet_destroy(), padico_tasklet_worker(), padico_tm_req_wait(), and padico_tm_task_engine_init().
◆ padico_tasklet_schedule()
| void padico_tasklet_schedule | ( | padico_tasklet_t | t, |
| void * | data, | ||
| const char * | name | ||
| ) |
schedule a new task item to the tasklet
Definition at line 535 of file tm-taskengine.c.
References a, padico_tasklet_s::actions, assert(), data, f, i, padico_tasklet_s::level, padico_tasklet_s::list_event, listener_num, padico_tasklet_s::lock, name, padico_tasklet_s::name, NULL, padico_tasklet_s::owner, PADICO_TASKLET_OWNER_NULL, padico_tasklet_s::subscribers, and te.
Referenced by padico_control_delete_node(), padico_control_deliver_message(), padico_control_new_node(), padico_control_plug_connector(), padico_control_plug_controler(), padico_control_plug_selector(), padico_control_unplug_connector(), padico_control_unplug_controler(), padico_control_unplug_selector(), and padico_tm_task_enqueue_from().
◆ padico_tasklet_subscribe()
| void padico_tasklet_subscribe | ( | padico_tasklet_t | t, |
| padico_event_listener_t | f | ||
| ) |
Add an event listener to the tasklet.
Definition at line 515 of file tm-taskengine.c.
References assert(), f, padico_tasklet_s::lock, padico_tasklet_s::owner, and padico_tasklet_s::subscribers.
Referenced by padico_control_event_subscribe(), padico_control_init(), and padico_tm_task_engine_init().
◆ padico_tasklet_unsubscribe()
| void padico_tasklet_unsubscribe | ( | padico_tasklet_t | t, |
| padico_event_listener_t | f | ||
| ) |
Remove an event listener from a tasklet.
Definition at line 524 of file tm-taskengine.c.
References assert(), f, i, padico_tasklet_s::lock, NULL, padico_tasklet_s::owner, and padico_tasklet_s::subscribers.
Referenced by padico_control_event_unsubscribe(), and padico_control_finalize().
◆ padico_tasklet_worker()
Definition at line 425 of file tm-taskengine.c.
References padico_tasklet_s::actions, arg, assert(), l, padico_tasklet_s::level, padico_tasklet_s::list_event, padico_tasklet_s::lock, padico_tasklet_s::name, NULL, padico_tasklet_s::owner, padico_tasklet_dispatch(), PADICO_TASKLET_OWNER_NULL, padico_tasklet_release(), padico_tm_thread_givename(), padico_tasklet_s::running, tasklet, and te.
Referenced by padico_tasklet_new().
◆ padico_tm_task_engine_finalize()
Definition at line 113 of file tm-taskengine.c.
References padico_tasklet_destroy(), and te.
Referenced by padico_tm_finalize().
◆ padico_tm_task_engine_init()
Definition at line 96 of file tm-taskengine.c.
References NULL, padico_tasklet_acquire(), padico_tasklet_new(), padico_tasklet_release(), padico_tasklet_subscribe(), padico_tm_tasks_process(), and te.
Referenced by padico_taskmanager_init().
◆ padico_tm_task_engine_run()
Definition at line 233 of file tm-taskengine.c.
References padico_task_s::argc, padico_task_s::argv, padico_task_s::func, padico_task_s::mainthread, NULL, te, and padico_task_s::tinfo.
Referenced by padico_taskmanager_run().
◆ padico_tm_tasks_process()
Definition at line 143 of file tm-taskengine.c.
References padico_task_s::cmd, padico_task_s::cmdtask, padico_task_s::file, padico_task_s::ftask, padico_task_s::kind, NULL, padico_tm_mod_process(), padico_tm_req_notify(), PUK_ABI_PROC_WRAP, rc, req, padico_task_s::task_req, te, padico_task_s::tinfo, and padico_task_s::trust_level.
Referenced by padico_tm_task_engine_init(), and padico_tm_task_enqueue_from().
◆ tm_req_async_notifier()
Definition at line 348 of file tm-taskengine.c.
Referenced by padico_tm_req_notify().
Variable Documentation
◆ current_tasklet
| marcel_key_t current_tasklet |
Definition at line 84 of file tm-taskengine.c.
◆ data
place-holder for actual data
Definition at line 44 of file tm-taskengine.c.
Referenced by main(), padico_mem_monitor_worker(), padico_tasklet_schedule(), read_tube(), remote_control_control_callback(), remote_control_control_send(), vrp_buffer_add_critical(), vrp_buffer_construct(), vrp_test_run(), and write_tube().
◆ listener
| padico_event_listener_t listener |
Definition at line 45 of file tm-taskengine.c.
Referenced by padico_vsock_passive_connect(), vlink_sf_accept_finalizer(), and vsock_vopw_listen().
◆ listener_num
| int* listener_num |
Definition at line 46 of file tm-taskengine.c.
Referenced by padico_tasklet_schedule().
◆ main_cond
| marcel_cond_t main_cond |
Definition at line 81 of file tm-taskengine.c.
◆ main_lock
| marcel_mutex_t main_lock |
Definition at line 80 of file tm-taskengine.c.
◆ main_task
| padico_task_t main_task |
Definition at line 82 of file tm-taskengine.c.
◆ name
| char* name |
Definition at line 47 of file tm-taskengine.c.
Referenced by padico_tasklet_new(), padico_tasklet_schedule(), and padico_tm_task_enqueue_from().
◆ next_req_id
| padico_req_id_t next_req_id |
Definition at line 75 of file tm-taskengine.c.
◆ padico_event_listener_vect_t
| typdef struct padico_event_listener_vect_s* padico_event_listener_vect_t |
Definition at line 52 of file tm-taskengine.c.
◆ padico_mod_binary__PadicoTM
|
extern |
◆ padico_tasklet_action
| padico_tasklet_action |
an action item for a tasklet
Definition at line 42 of file tm-taskengine.c.
◆ req_finished
| marcel_cond_t req_finished |
Definition at line 77 of file tm-taskengine.c.
◆ req_lock
| marcel_mutex_t req_lock |
Definition at line 76 of file tm-taskengine.c.
◆ reqs
| struct padico_req_list_s reqs |
Definition at line 78 of file tm-taskengine.c.
Referenced by vlink_control_resolve().
◆ tasklet
| padico_tasklet_t tasklet |
Definition at line 43 of file tm-taskengine.c.
Referenced by padico_tasklet_dispatch(), padico_tasklet_worker(), padico_tm_req_wait(), and padico_tm_task_enqueue_from().
◆ tasks
| padico_tasklet_t tasks |
Definition at line 73 of file tm-taskengine.c.
◆ [struct]
| struct { ... } te |
Referenced by padico_tasklet_schedule(), padico_tasklet_worker(), padico_tm_req_new(), padico_tm_req_notify(), padico_tm_req_wait(), padico_tm_task_engine_finalize(), padico_tm_task_engine_init(), padico_tm_task_engine_run(), padico_tm_task_enqueue_from(), and padico_tm_tasks_process().