diff options
author | bubulle <bubulle@alioth.debian.org> | 2010-04-04 16:44:16 +0000 |
---|---|---|
committer | bubulle <bubulle@alioth.debian.org> | 2010-04-04 16:44:16 +0000 |
commit | 9e2f5a6ab663f7a111832217c527508c75ddae8a (patch) | |
tree | 2e74616febbb3fb658ce2dcc5f9cff00ad4fdb4a /source3/include/pthreadpool.h | |
parent | b5556af8f75a4f74db404dd43ee7abafa2be6ca4 (diff) | |
download | samba-9e2f5a6ab663f7a111832217c527508c75ddae8a.tar.gz |
Merge 3.5.1 from experimental
git-svn-id: svn://svn.debian.org/svn/pkg-samba/trunk/samba@3414 fc4039ab-9d04-0410-8cac-899223bdd6b0
Diffstat (limited to 'source3/include/pthreadpool.h')
-rw-r--r-- | source3/include/pthreadpool.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/source3/include/pthreadpool.h b/source3/include/pthreadpool.h new file mode 100644 index 0000000000..7ef7ddf419 --- /dev/null +++ b/source3/include/pthreadpool.h @@ -0,0 +1,42 @@ +/* + * Unix SMB/CIFS implementation. + * threadpool implementation based on pthreads + * Copyright (C) Volker Lendecke 2009 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef __PTHREADPOOL_H__ +#define __PTHREADPOOL_H__ + +struct pthreadpool; + +int pthreadpool_init(unsigned max_threads, struct pthreadpool **presult); +int pthreadpool_destroy(struct pthreadpool *pool); + +/* + * Add a job to a pthreadpool. + */ +int pthreadpool_add_job(struct pthreadpool *pool, int job_id, + void (*fn)(void *private_data), void *private_data); + +/* + * Get the signalling fd out of a thread pool. This fd will become readable + * when a job is finished. The job that finished can be retrieved via + * pthreadpool_finished_job(). + */ +int pthreadpool_sig_fd(struct pthreadpool *pool); +int pthreadpool_finished_job(struct pthreadpool *pool); + +#endif |