Blame usr/actor.h

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