summaryrefslogtreecommitdiff
path: root/usr/actor.h
diff options
context:
space:
mode:
authoropen-iscsi <open-iscsi@d7303112-9cec-0310-bdd2-e83a94d6c2b6>2005-01-27 02:43:10 +0000
committeropen-iscsi <open-iscsi@d7303112-9cec-0310-bdd2-e83a94d6c2b6>2005-01-27 02:43:10 +0000
commit6075cc166aeb6749fcb5da468f0487a1ef355169 (patch)
treec0e82dc07a7b892f763533f1b3a09486ad5635ae /usr/actor.h
parent42dcb521c40af204c536fb8940874c3654495f7b (diff)
downloadopen-iscsi-6075cc166aeb6749fcb5da468f0487a1ef355169.tar.gz
sched renamed to actor, provider structure added, u/k work began
git-svn-id: svn://svn.berlios.de/open-iscsi@45 d7303112-9cec-0310-bdd2-e83a94d6c2b6
Diffstat (limited to 'usr/actor.h')
-rw-r--r--usr/actor.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/usr/actor.h b/usr/actor.h
new file mode 100644
index 0000000..33f8257
--- /dev/null
+++ b/usr/actor.h
@@ -0,0 +1,52 @@
+/*
+ * iSCSI usermode single-threaded scheduler
+ *
+ * Copyright (C) 2004 Dmitry Yusupov, Alex Aizman
+ * maintained by open-iscsi@@googlegroups.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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
+ * General Public License for more details.
+ *
+ * See the file COPYING included with this distribution for more details.
+ */
+#ifndef SCHED_H
+#define SCHED_H
+
+#include "types.h"
+
+#define SCHED_RESOLUTION 250 /* in millis */
+#define SCHED_MAX_LOOPS 1
+
+typedef enum actor_state_e {
+ SCHED_WAITING,
+ SCHED_SCHEDULED,
+ SCHED_NOTSCHEDULED,
+ SCHED_POLL_WAITING
+} actor_state_e;
+
+typedef struct actor {
+ struct qelem item;
+ actor_state_e state;
+ void *data;
+ void (*callback)(void * );
+ uint32_t scheduled_at;
+ uint32_t ttschedule;
+} actor_t;
+
+extern void actor_new(actor_t *thread, void (*callback)(void *), void * data);
+extern void actor_delete(actor_t *thread);
+extern void actor_schedule(actor_t *thread);
+extern void actor_timer(actor_t *thread, uint32_t timeout,
+ void (*callback)(void *), void *data);
+extern int actor_timer_mod(actor_t *thread, uint32_t new_timeout, void *data);
+extern void actor_poll(void);
+extern void actor_init(void);
+
+#endif