-
Notifications
You must be signed in to change notification settings - Fork 1
API
Kostadin Atanasov edited this page May 2, 2013
·
9 revisions
Include:
<libfly/fly.h>
int fly_simple_init(int half_nbt);
int fly_uninit();
typedef void (*fly_parallel_for_func)(int, void*);
int fly_parallel_for(int count, fly_parallel_for_func func, void *ptr);
Logically equivalent to:
for (int i = 0; i < count; i++)
func(i, ptr);
int fly_parallel_for_arr(int start, int end, fly_parallel_for_func func, void *arr, size_t elsize);
Given the ideal case that (((end - start) % half_nbt) == 0) logically equivalent to:
int partition = (end - start) / half_nbt;
for (int i = 0; i < half_nbt; i++)
for (int j = 0; j < partition; j++)
func(j + (i * partition), arr[j + (i *partition)]);
typedef void *(*fly_task_func)(void*);
struct fly_task *fly_create_task(fly_task_func func, void *param);
void fly_destroy_task(struct fly_task *task);
int fly_push_task(struct fly_task *task);
int fly_wait_task(struct fly_task *task);
int fly_wait_tasks(struct fly_task **tasks, int nbtasks);
void *fly_get_task_result(struct fly_task *task);