GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
taskq.h
Go to the documentation of this file.
1 
7 #ifndef GHOST_TASKQ_H
8 #define GHOST_TASKQ_H
9 
10 #include <pthread.h>
11 #include <hwloc.h>
12 #include "error.h"
13 #include "task.h"
14 
18 typedef struct {
30  pthread_mutex_t mutex;
31 } ghost_taskq;
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 
44 
48 ghost_error ghost_taskq_startroutine(void *(**func)(void *));
49 
50 extern ghost_taskq *taskq;
51 
52 #ifdef __cplusplus
53 }// extern "C"
54 #endif
55 
56 #endif
57 
This structure represents a GHOST task.
Definition: task.h:84
ghost_error ghost_taskq_waitall()
Wait for all tasks in all queues to be finished.
Definition: taskq.c:641
ghost_error ghost_taskq_waitsome(ghost_task **, int, int *)
Wait for some tasks out of a given list of tasks.
Definition: taskq.c:679
ghost_taskq * taskq
The task queue created by ghost_taskq_create().
Definition: taskq.c:44
ghost_task * head
The first (= highest priority) task in the queue.
Definition: taskq.h:22
The task queue.
Definition: taskq.h:18
ghost_error ghost_taskq_startroutine(void *(**func)(void *))
Definition: taskq.c:379
ghost_error ghost_taskq_add(ghost_task *task)
Helper function to add a task to a queue.
Definition: taskq.c:535
Types, functions and macros for error handling.
pthread_mutex_t mutex
Serialize access to the queue.
Definition: taskq.h:30
ghost_error
Error return type.
Definition: error.h:23
ghost_error ghost_taskq_destroy()
Execute all outstanding threads and free the task queues' resources.
Definition: taskq.c:600
Types and functions for the tasks.
ghost_error ghost_taskq_create()
Initializes a task queues.
Definition: taskq.c:86
ghost_task * tail
The last (= lowest priority) task in the queue.
Definition: taskq.h:26