Move processor_t (thread-pool) to libhydra.
[strongswan.git] / src / libhydra / processing / jobs / job.h
1 /*
2 * Copyright (C) 2005-2006 Martin Willi
3 * Copyright (C) 2005 Jan Hutter
4 * Hochschule fuer Technik Rapperswil
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 */
16
17 /**
18 * @defgroup job job
19 * @{ @ingroup jobs
20 */
21
22 #ifndef JOB_H_
23 #define JOB_H_
24
25 typedef struct job_t job_t;
26
27 #include <library.h>
28
29 /**
30 * Job-Interface as it is stored in the job queue.
31 */
32 struct job_t {
33
34 /**
35 * Execute a job.
36 *
37 * The processing facility executes a job using this method. Jobs are
38 * one-shot, they destroy themself after execution, so don't use a job
39 * once it has been executed.
40 */
41 void (*execute) (job_t *this);
42
43 /**
44 * Destroy a job.
45 *
46 * Is only called whenever a job was not executed (e.g. due daemon shutdown).
47 * After execution, jobs destroy themself.
48 */
49 void (*destroy) (job_t *job);
50 };
51
52 #endif /** JOB_H_ @}*/