Blame usr/actor.h

Packit eace71
/*
Packit eace71
 * iSCSI usermode single-threaded scheduler
Packit eace71
 *
Packit eace71
 * Copyright (C) 2004 Dmitry Yusupov, Alex Aizman
Packit eace71
 * maintained by open-iscsi@googlegroups.com
Packit eace71
 *
Packit eace71
 * This program is free software; you can redistribute it and/or modify
Packit eace71
 * it under the terms of the GNU General Public License as published
Packit eace71
 * by the Free Software Foundation; either version 2 of the License, or
Packit eace71
 * (at your option) any later version.
Packit eace71
 *
Packit eace71
 * This program is distributed in the hope that it will be useful, but
Packit eace71
 * WITHOUT ANY WARRANTY; without even the implied warranty of
Packit eace71
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Packit eace71
 * General Public License for more details.
Packit eace71
 *
Packit eace71
 * See the file COPYING included with this distribution for more details.
Packit eace71
 */
Packit eace71
#ifndef ACTOR_H
Packit eace71
#define ACTOR_H
Packit eace71
Packit eace71
#include "types.h"
Packit eace71
#include "list.h"
Packit eace71
Packit eace71
typedef enum actor_state_e {
Packit eace71
    ACTOR_INVALID,
Packit eace71
    ACTOR_WAITING,
Packit eace71
    ACTOR_SCHEDULED,
Packit eace71
    ACTOR_NOTSCHEDULED,
Packit eace71
} actor_state_e;
Packit eace71
Packit eace71
typedef struct actor {
Packit eace71
	struct list_head list;
Packit eace71
	actor_state_e state;
Packit eace71
	void *data;
Packit eace71
	void (*callback)(void * );
Packit eace71
	time_t ttschedule;
Packit eace71
} actor_t;
Packit eace71
Packit eace71
extern void actor_init(actor_t *thread, void (*callback)(void *), void * data);
Packit eace71
extern void actor_delete(actor_t *thread);
Packit eace71
extern void actor_schedule_head(actor_t *thread);
Packit eace71
extern void actor_schedule(actor_t *thread);
Packit eace71
extern void actor_timer(actor_t *thread, uint32_t delay_secs,
Packit eace71
			void (*callback)(void *), void *data);
Packit eace71
extern void actor_timer_mod(actor_t *thread, uint32_t new_delay_secs,
Packit eace71
			    void *data);
Packit eace71
extern void actor_poll(void);
Packit eace71
Packit eace71
#endif /* ACTOR_H */