threadpool.h
00001 /*
00002  * 3D Shape Analysis Library.
00003  * Copyright (C) 2008 AQSENSE, S.L.
00004  */
00005 #if !defined (AQSENSE_SAL3D_THREADPOOL_H)
00006 #define AQSENSE_SAL3D_THREADPOOL_H
00007 
00008 #if defined (_MSC_VER) && (_MSC_VER >= 1020)
00009 #pragma once
00010 #endif /* _MSC_VER && _MSC_VER >= 1020 */
00011 
00012 #include "sal3d_def.h"
00013 
00014 /*
00015  * Type definition.
00016  * --------------------------------
00017  */
00018 
00019 typedef struct sal3d_threadpool
00020 {
00021     void *p;
00022 } sal3d_threadpool;
00023 
00024 typedef void (*sal3d_threadpool_task_cb)(void *);
00025 
00026 /*
00027  * Functions.
00028  * --------------------------------
00029  */
00030 
00031 SAL3D_API(int) sal3d_threadpool_check_validity (const sal3d_threadpool pool,
00032         sal3d_error *e DEFZERO);
00033 
00034 SAL3D_API(int) sal3d_threadpool_new (int nthreads, sal3d_threadpool *pool,
00035         const char *basename, sal3d_error *e DEFZERO);
00036 
00037 SAL3D_API(int) sal3d_threadpool_delete (sal3d_threadpool *pool,
00038         sal3d_error *e DEFZERO);
00039 
00040 SAL3D_API(int) sal3d_threadpool_post (sal3d_threadpool pool,
00041         sal3d_threadpool_task_cb cb, void *cbdata,
00042         sal3d_error *e DEFZERO);
00043 
00044 
00045 SAL3D_API(int)
00046 sal3d_threadpool_post_sequential (sal3d_threadpool pool,
00047         sal3d_threadpool_task_cb cb, void *cbdata,
00048         sal3d_threadpool_task_cb sequentialcb,
00049         void *sequentialcbdata,
00050         sal3d_error *e DEFZERO);
00051 
00052 SAL3D_API(int) sal3d_threadpool_wait (sal3d_threadpool pool,
00053         sal3d_error *e DEFZERO);
00054 
00055 SAL3D_API(int) sal3d_threadpool_wait_timeout (sal3d_threadpool pool,
00056         int timeoutms,
00057         sal3d_error *e DEFZERO);
00058 
00059 #endif /* !AQSENSE_SAL3D_THREADPOOL_H */