File: workqueue.h

package info (click to toggle)
eigensoft 6.1.4%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,832 kB
  • ctags: 2,106
  • sloc: ansic: 36,435; perl: 648; makefile: 118; sh: 10
file content (34 lines) | stat: -rw-r--r-- 588 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef WORKQUEUE_H
#define WORKQUEUE_H

#ifdef HAVE_PTHREAD
#include <pthread.h>
#endif

typedef struct work_task_t
{
#ifdef HAVE_PTHREAD
  pthread_t thread;
#endif
  void *
  (*start_routine) (void*);
  void *argument;
} work_task;

typedef struct work_queue_t
{
  // Which tasks are pending?
  work_task *tasks;
  int num_tasks;
} work_queue;

void
create_work_queue (work_queue **the_queue);
void
destroy_work_queue (work_queue **the_queue);
void
queue_task (work_queue* queue, const work_task* task);
void
wait_for_queue_to_complete (const work_queue *queue);

#endif // WORKQUEUE_H