mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-03 20:39:41 -05:00
This is the first attempt at moving all internal parts from using struct timeval to integer ticks. Those provides simpler and faster code due to simplified operations, and this change also saved about 64 bytes per session. A new header file has been added : include/common/ticks.h. It is possible that some functions should finally not be inlined because they're used quite a lot (eg: tick_first, tick_add_ifset and tick_is_expired). More measurements are required in order to decide whether this is interesting or not. Some function and variable names are still subject to change for a better overall logics.
52 lines
1.6 KiB
C
52 lines
1.6 KiB
C
/*
|
|
include/types/task.h
|
|
Macros, variables and structures for task management.
|
|
|
|
Copyright (C) 2000-2008 Willy Tarreau - w@1wt.eu
|
|
|
|
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>
|
|
|
|
#include <common/config.h>
|
|
#include <common/eb32tree.h>
|
|
#include <common/mini-clist.h>
|
|
|
|
/* values for task->state */
|
|
#define TASK_IDLE 0
|
|
#define TASK_RUNNING 1
|
|
|
|
/* The base for all tasks */
|
|
struct task {
|
|
struct eb32_node eb; /* ebtree node used to hold the task in the wait queue */
|
|
int state; /* task state : IDLE or RUNNING */
|
|
unsigned int expire; /* next expiration time for this task */
|
|
void (*process)(struct task *t, int *next); /* the function which processes the task */
|
|
void *context; /* the task's context */
|
|
int nice; /* the task's current nice value from -1024 to +1024 */
|
|
};
|
|
|
|
#endif /* _TYPES_TASK_H */
|
|
|
|
/*
|
|
* Local variables:
|
|
* c-indent-level: 8
|
|
* c-basic-offset: 8
|
|
* End:
|
|
*/
|