From 6dd488b87fdc47fb377ba648a6cd598bdab87f59 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 8 Mar 2015 19:07:48 +0100 Subject: Implement select ; add two tests for channels. --- src/kernel/include/thread.h | 4 +++- src/kernel/include/vfs.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/kernel/include') diff --git a/src/kernel/include/thread.h b/src/kernel/include/thread.h index 09995fd..f9df0ea 100644 --- a/src/kernel/include/thread.h +++ b/src/kernel/include/thread.h @@ -36,7 +36,6 @@ typedef struct thread { struct thread *next_in_queue; struct thread *next_in_proc; - void* waiting_on; bool must_exit; } thread_t; @@ -46,6 +45,8 @@ void threading_setup(entry_t cont, void* data); // never returns thread_t *new_thread(entry_t entry, void* data); // thread is PAUSED, and must be started with start_thread void start_thread(thread_t *t); +void irq0_handler(registers_t *regs, int crit_level); + extern thread_t *current_thread; void yield(); @@ -60,6 +61,7 @@ void usleep(int usecs); // killed and must terminate its kernel-land processing as soon as possible. bool wait_on(void* x); // true : resumed normally, false : resumed because thread was killed, or someone else already waiting +bool wait_on_many(void** x, size_t count); // true only if we could wait on ALL objects bool resume_on(void* x); void kill_thread(thread_t *thread); // cannot be called for current thread diff --git a/src/kernel/include/vfs.h b/src/kernel/include/vfs.h index 371ffb7..a56ecae 100644 --- a/src/kernel/include/vfs.h +++ b/src/kernel/include/vfs.h @@ -86,6 +86,7 @@ typedef struct fs_node_ops { size_t (*read)(fs_handle_t *f, size_t offset, size_t len, char* buf); size_t (*write)(fs_handle_t *f, size_t offset, size_t len, const char* buf); bool (*readdir)(fs_handle_t *f, size_t ent_no, dirent_t *d); + int (*poll)(fs_handle_t *f, void** out_wait_obj); void (*close)(fs_handle_t *f); bool (*stat)(fs_node_ptr n, stat_t *st); @@ -181,5 +182,6 @@ size_t file_read(fs_handle_t *f, size_t offset, size_t len, char* buf); size_t file_write(fs_handle_t *f, size_t offset, size_t len, const char* buf); int file_ioctl(fs_handle_t *f, int command, void* data); bool file_readdir(fs_handle_t *f, size_t ent_no, dirent_t *d); +int file_poll(fs_handle_t *f, void** out_wait_obj); // just polls the file & returns a mask of SEL_* (see ) /* vim: set ts=4 sw=4 tw=0 noet :*/ -- cgit v1.2.3