Helixis 1.0
Task Programming API
Data Structures | Functions
sources/internal_includes/native/native_task_groups.h File Reference

Go to the source code of this file.

Data Structures

struct  hlx_group

Functions

void hlx_group_construct (hlx_group *)
void hlx_group_destruct (hlx_group *)
void hlx_group_add_task (hlx_group *, hlx_task *)
atom_t hlx_group_get_size (hlx_group *)

Function Documentation

void hlx_group_add_task ( hlx_group ,
hlx_task  
)
void hlx_group_construct ( hlx_group )

Definition at line 50 of file parallel_task_groups.c.

References hlx_list_construct(), hlx_group::id, MAX_TASK_PER_GROUP, queue_new(), hlx_group::size, hlx_group::tasks, hlx_api::thread_api, and hlx_thread_api::thread_construct.

Referenced by hlx_core_create_group(), and hlx_scheduler_construct().

{
        group->id = (hlx_group_id)group;
        hlx_list_construct(&group->tasks);
        queue_new(&group->buf_tasks, MAX_TASK_PER_GROUP);
        gl_api.thread_api.thread_construct(&(group->thread));
        group->size = 0;
        group->active_count = 0;
}
void hlx_group_destruct ( hlx_group )

Definition at line 60 of file parallel_task_groups.c.

References _hlx_list_node::data, hlx_list::first, hlx_api::free_entry, hlx_list_clear(), _hlx_list_node::next, queue_delete(), queue_dequeue(), hlx_task::stack, hlx_group::tasks, hlx_api::thread_api, and hlx_thread_api::thread_destruct.

Referenced by hlx_scheduler_destruct().

{
        hlx_list_node* it = group->tasks.first;
        hlx_task* task;

        while (it != 0)
        {
                task = it->data;
                if (task->stack != 0)
                        gl_api.free_entry(task->stack);
                gl_api.free_entry(it->data);
                it = it->next;
        }
        hlx_list_clear(&group->tasks);
        while (queue_dequeue(group->buf_tasks, (void**)&task))
        {
                if (task->stack != 0)
                        gl_api.free_entry(task->stack);
                gl_api.free_entry(task);
        }
        queue_delete(group->buf_tasks, 0, 0);
        gl_api.thread_api.thread_destruct(&(group->thread));
}
atom_t hlx_group_get_size ( hlx_group )

Definition at line 123 of file parallel_task_groups.c.

References queue_query(), QUEUE_QUERY_ELEMENT_COUNT, hlx_list::size, and hlx_group::tasks.

Referenced by hlx_sheduler_find_lighter_group().

{
        atom_t queue_size;

        queue_query(group->buf_tasks, QUEUE_QUERY_ELEMENT_COUNT, 0, &queue_size);
        return (group->tasks.size + queue_size);
}
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines