3 /* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
9 #ifndef _XBT_THREADPOOL_H
10 #define _XBT_THREADPOOL_H
12 #include "xbt/misc.h" /* SG_BEGIN_DECL */
13 #include "xbt/function_types.h"
17 /** @addtogroup XBT_threadpool
18 * @brief Pool of threads.
20 * Jobs can be queued and the dispacher process can wait for the completion
22 * The call to "queue job" is non-blocking except the maximum amount of
23 * queued jobs is reached. In that case, it will block until a job is taken
27 /** \brief Queue data type (opaque type) */
29 typedef struct s_xbt_tpool *xbt_tpool_t;
31 XBT_PUBLIC(xbt_tpool_t) xbt_tpool_new(unsigned int num_workers,
32 unsigned int max_jobs);
34 XBT_PUBLIC(void) xbt_tpool_queue_job(xbt_tpool_t tpool,
38 XBT_PUBLIC(void) xbt_tpool_wait_all(xbt_tpool_t tpool);
40 XBT_PUBLIC(void) xbt_tpool_destroy(xbt_tpool_t tpool);