diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-08-20 13:51:45 +1200 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2020-09-14 16:44:09 +1200 |
commit | d387029f39d976565c955377117103499d47ff09 (patch) | |
tree | 0a28459f929867c698d243584bc676c4ddad100c /internal | |
parent | 905e9c8093b2bb06def609975929465be0f41a0c (diff) | |
download | ruby-d387029f39d976565c955377117103499d47ff09.tar.gz |
Standardised scheduler interface.
Diffstat (limited to 'internal')
-rw-r--r-- | internal/scheduler.h | 27 | ||||
-rw-r--r-- | internal/thread.h | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/internal/scheduler.h b/internal/scheduler.h new file mode 100644 index 0000000000..be976d7be5 --- /dev/null +++ b/internal/scheduler.h @@ -0,0 +1,27 @@ +#ifndef RUBY_SCHEDULER_H /*-*-C-*-vi:se ft=c:*/ +#define RUBY_SCHEDULER_H +/** + * @file + * @author Ruby developers <ruby-core@ruby-lang.org> + * @copyright This file is a part of the programming language Ruby. + * Permission is hereby granted, to either redistribute and/or + * modify this file, provided that the conditions mentioned in the + * file COPYING are met. Consult the file for details. + * @brief Internal header for Scheduler. + */ +#include "ruby/ruby.h" +#include "ruby/intern.h" + +VALUE rb_scheduler_timeout(struct timeval *timeout); + +VALUE rb_scheduler_kernel_sleep(VALUE scheduler, VALUE duration); +VALUE rb_scheduler_kernel_sleepv(VALUE scheduler, int argc, VALUE * argv); + +VALUE rb_scheduler_io_wait(VALUE scheduler, VALUE io, VALUE events, VALUE timeout); +VALUE rb_scheduler_io_wait_readable(VALUE scheduler, VALUE io); +VALUE rb_scheduler_io_wait_writable(VALUE scheduler, VALUE io); + +VALUE rb_scheduler_io_read(VALUE scheduler, VALUE io, VALUE buffer, VALUE offset, VALUE length); +VALUE rb_scheduler_io_write(VALUE scheduler, VALUE io, VALUE buffer, VALUE offset, VALUE length); + +#endif /* RUBY_SCHEDULER_H */ diff --git a/internal/thread.h b/internal/thread.h index e7a9019b88..13e419bc95 100644 --- a/internal/thread.h +++ b/internal/thread.h @@ -37,6 +37,8 @@ void rb_mutex_allow_trap(VALUE self, int val); VALUE rb_uninterruptible(VALUE (*b_proc)(VALUE), VALUE data); VALUE rb_mutex_owned_p(VALUE self); +int rb_thread_wait_for_single_fd(int fd, int events, struct timeval * timeout); + VALUE rb_thread_scheduler_get(VALUE thread); VALUE rb_thread_scheduler_set(VALUE thread, VALUE scheduler); |