2006-06-25 20:48:02 -04:00
|
|
|
/*
|
|
|
|
|
include/types/task.h
|
|
|
|
|
Macros, variables and structures for task management.
|
|
|
|
|
|
2008-06-24 02:17:16 -04:00
|
|
|
Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
|
2006-06-25 20:48:02 -04:00
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
License as published by the Free Software Foundation, version 2.1
|
|
|
|
|
exclusively.
|
|
|
|
|
|
|
|
|
|
This library 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
|
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
License along with this library; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _TYPES_TASK_H
|
|
|
|
|
#define _TYPES_TASK_H
|
|
|
|
|
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
2006-06-29 12:54:54 -04:00
|
|
|
#include <common/config.h>
|
2008-06-24 02:17:16 -04:00
|
|
|
#include <common/eb32tree.h>
|
2007-04-29 04:41:56 -04:00
|
|
|
#include <common/mini-clist.h>
|
2006-06-25 20:48:02 -04:00
|
|
|
|
|
|
|
|
/* values for task->state */
|
|
|
|
|
#define TASK_IDLE 0
|
|
|
|
|
#define TASK_RUNNING 1
|
|
|
|
|
|
|
|
|
|
/* The base for all tasks */
|
|
|
|
|
struct task {
|
2008-06-24 02:17:16 -04:00
|
|
|
struct eb32_node eb; /* ebtree node used to hold the task in the wait queue */
|
2007-04-29 04:41:56 -04:00
|
|
|
int state; /* task state : IDLE or RUNNING */
|
2008-07-06 18:09:58 -04:00
|
|
|
unsigned int expire; /* next expiration time for this task */
|
|
|
|
|
void (*process)(struct task *t, int *next); /* the function which processes the task */
|
2006-06-25 20:48:02 -04:00
|
|
|
void *context; /* the task's context */
|
2008-06-30 01:51:00 -04:00
|
|
|
int nice; /* the task's current nice value from -1024 to +1024 */
|
2006-06-25 20:48:02 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif /* _TYPES_TASK_H */
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Local variables:
|
|
|
|
|
* c-indent-level: 8
|
|
|
|
|
* c-basic-offset: 8
|
|
|
|
|
* End:
|
|
|
|
|
*/
|