Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[trace] detailed description of new configuration options
[simgrid.git] / src / xbt / threadpool_private.h
1 /* Copyright (c) 2004, 2005, 2007, 2009, 2010. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _XBT_THREADPOOL_PRIVATE_H
8 #define _XBT_THREADPOOL_PRIVATE_H
9
10 #include "xbt/threadpool.h"
11 #include "xbt/xbt_os_thread.h"
12 #include "xbt/sysdep.h"
13 #include "xbt/dynar.h"
14
15 typedef enum{
16   TPOOL_WAIT = 0,
17   TPOOL_DESTROY
18 } e_xbt_tpool_flag_t;
19
20 typedef struct s_xbt_tpool {
21   xbt_os_mutex_t mutex;           /* pool's mutex */
22   xbt_os_cond_t job_posted;       /* job is posted */
23   xbt_os_cond_t job_taken;        /* job is taken */
24   xbt_os_cond_t all_jobs_done;    /* all jobs are finished */ 
25   xbt_dynar_t jobs_queue;
26   e_xbt_tpool_flag_t flags;
27   unsigned int num_workers;
28   unsigned int max_jobs;
29 } s_xbt_tpool_t;
30
31 typedef struct s_xbt_tpool_job {
32   void_f_pvoid_t fun;
33   void *fun_arg;
34 } s_xbt_tpool_job_t, *xbt_tpool_job_t;
35
36 #endif