File: workqueue.h

package info (click to toggle)
eigensoft 7.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,696 kB
  • sloc: ansic: 32,354; perl: 470; makefile: 107; sh: 10
file content (29 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (4)
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
#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