![]() |
Helixis 1.0
Task Programming API
|
Go to the source code of this file.
Functions | |
void | hlx_scheduler_schedule (void) |
void | hlx_scheduler_construct (void) |
void | hlx_sheduler_end_all_threads (void) |
void | hlx_scheduler_destruct (void) |
int | hlx_core_init (void) |
void | hlx_core_start (void) |
void | hlx_core_stop (void) |
void | hlx_core_destroy (void) |
Variables | |
hlx_api | gl_api |
hlx_scheduler | gl_scheduler |
void hlx_core_destroy | ( | void | ) |
Free all resources
Definition at line 89 of file parallel_core.c.
References _destroy_channel_manager(), and hlx_scheduler_destruct().
int hlx_core_init | ( | void | ) |
Initialize the Framework
Definition at line 60 of file parallel_core.c.
References _init_channel_manager(), hlx_api::aligned_free_entry, hlx_api::aligned_malloc_entry, hlx_api::atomic_cas_entry, hlx_api::atomic_dcas_entry, hlx_api::atomic_decr_entry, hlx_api::atomic_incr_entry, hlx_api::free_entry, hlx_memcpy(), hlx_scheduler_construct(), hlx_api::malloc_entry, hlx_api::memcpy_entry, hlx_api::thread_api, hlx_thread_api::thread_construct, hlx_thread_api::thread_destruct, hlx_thread_api::thread_execute, hlx_thread_api::thread_pause_if_needed, hlx_thread_api::thread_resume, hlx_thread_api::thread_suspend, hlx_thread_api::thread_wait_for, and hlx_thread_api::thread_yield.
{ if (gl_api.memcpy_entry == 0) gl_api.memcpy_entry = hlx_memcpy; if (gl_api.malloc_entry == 0 || gl_api.free_entry == 0 || gl_api.atomic_cas_entry == 0 || gl_api.atomic_dcas_entry == 0 || gl_api.atomic_incr_entry == 0 || gl_api.atomic_decr_entry == 0 || gl_api.aligned_free_entry == 0 || gl_api.aligned_malloc_entry == 0) return (0); if (gl_api.thread_api.thread_construct == 0 || gl_api.thread_api.thread_destruct == 0 || gl_api.thread_api.thread_execute == 0 || gl_api.thread_api.thread_pause_if_needed == 0 || gl_api.thread_api.thread_resume == 0 || gl_api.thread_api.thread_suspend == 0 || gl_api.thread_api.thread_wait_for == 0 || gl_api.thread_api.thread_yield == 0) return (0); _init_channel_manager(); hlx_scheduler_construct(); return (1); }
void hlx_core_start | ( | void | ) |
Start the framework
Definition at line 79 of file parallel_core.c.
References hlx_scheduler_schedule().
{ hlx_scheduler_schedule(); }
void hlx_core_stop | ( | void | ) |
Stop the framework
Definition at line 84 of file parallel_core.c.
References hlx_sheduler_end_all_threads().
{ hlx_sheduler_end_all_threads(); }
void hlx_scheduler_construct | ( | void | ) |
Definition at line 49 of file sched.c.
References hlx_scheduler::cpu_count, hlx_scheduler::default_groups_id, hlx_api::get_cpu_count_entry, hlx_scheduler::groups, hlx_group_construct(), hlx_list_construct(), hlx_list_push_back(), hlx_scheduler::loop, and hlx_api::malloc_entry.
Referenced by hlx_core_init().
{ unsigned int i; hlx_group* group; gl_scheduler.loop = 0; #if defined(HLX_BUILD_WITH_PARALLEL_THREADING) gl_scheduler.launched = 0; #endif if (gl_api.get_cpu_count_entry != 0) { gl_scheduler.cpu_count = gl_api.get_cpu_count_entry(); if (gl_scheduler.cpu_count < 1) gl_scheduler.cpu_count = 1; } else gl_scheduler.cpu_count = 1; hlx_list_construct(&gl_scheduler.groups); gl_scheduler.default_groups_id = gl_api.malloc_entry(gl_scheduler.cpu_count * sizeof(*(gl_scheduler.default_groups_id))); if (!gl_scheduler.default_groups_id) return; for (i = 0; i < gl_scheduler.cpu_count; ++i) { group = gl_api.malloc_entry(sizeof(*group)); hlx_group_construct(group); hlx_list_push_back(&gl_scheduler.groups, group); gl_scheduler.default_groups_id[i] = (hlx_group_id)group; } }
void hlx_scheduler_destruct | ( | void | ) |
Definition at line 79 of file sched.c.
References _hlx_list_node::data, hlx_scheduler::default_groups_id, hlx_list::first, hlx_api::free_entry, hlx_scheduler::groups, hlx_event_get_default_manager(), hlx_event_manager_destroy(), hlx_group_destruct(), hlx_list_clear(), and _hlx_list_node::next.
Referenced by hlx_core_destroy().
{ hlx_list_node* it; for (it = gl_scheduler.groups.first; it != 0; it = it->next) { hlx_group_destruct(it->data); gl_api.free_entry(it->data); } hlx_list_clear(&gl_scheduler.groups); gl_api.free_entry(gl_scheduler.default_groups_id); hlx_event_manager_destroy(hlx_event_get_default_manager()); }
void hlx_scheduler_schedule | ( | void | ) |
Definition at line 191 of file parallel_sched.c.
References _hlx_list_node::data, hlx_list::first, hlx_scheduler::groups, hlx_scheduler_schedule_group_threaded(), hlx_scheduler::loop, _hlx_list_node::next, hlx_api::thread_api, hlx_thread_api::thread_execute, and hlx_thread_api::thread_wait_for.
Referenced by hlx_core_start().
{ hlx_list_node* it; hlx_group* g; gl_scheduler.loop = 1; gl_scheduler.launched = 1; for (it = gl_scheduler.groups.first; it != 0; it = it->next) { g = it->data; gl_api.thread_api.thread_execute(&g->thread, hlx_scheduler_schedule_group_threaded, g); } for (it = gl_scheduler.groups.first; it != 0; it = it->next) { g = it->data; gl_api.thread_api.thread_wait_for(&(g->thread)); } gl_scheduler.launched = 0; }
void hlx_sheduler_end_all_threads | ( | void | ) |
Definition at line 113 of file parallel_sched.c.
References _hlx_list_node::data, hlx_list::first, hlx_scheduler::groups, hlx_scheduler::loop, _hlx_list_node::next, hlx_api::thread_api, and hlx_thread_api::thread_resume.
Referenced by hlx_core_stop(), and hlx_scheduler_schedule_group_threaded().
{ hlx_list_node* it; hlx_group* group; gl_scheduler.loop = 0; for (it = gl_scheduler.groups.first; it; it = it->next) { group = it->data; gl_api.thread_api.thread_resume(&(group->thread)); } }
Definition at line 50 of file parallel_sched.c.