Ruby: scheduler.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Functions
scheduler.c File Reference
`#include "vm_core.h"`
`#include "internal/scheduler.h"`
`#include "ruby/io.h"`

Go to the source code of this file.

## Functions
void | Init_Scheduler (void)
VALUE | rb_scheduler_get (void)
VALUE | rb_scheduler_set (VALUE scheduler)
VALUE | rb_scheduler_current (void)
VALUE | rb_thread_scheduler_current (VALUE thread)
VALUE | rb_scheduler_close (VALUE scheduler)
VALUE | rb_scheduler_timeout (struct timeval *timeout)
VALUE | rb_scheduler_kernel_sleep (VALUE scheduler, VALUE timeout)
VALUE | rb_scheduler_kernel_sleepv (VALUE scheduler, int argc, VALUE *argv)
int | rb_scheduler_supports_process_wait (VALUE scheduler)
VALUE | rb_scheduler_process_wait (VALUE scheduler, rb_pid_t pid, int flags)
VALUE | rb_scheduler_block (VALUE scheduler, VALUE blocker, VALUE timeout)
VALUE | rb_scheduler_unblock (VALUE scheduler, VALUE blocker, VALUE fiber)
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)
int | rb_scheduler_supports_io_read (VALUE scheduler)
VALUE | rb_scheduler_io_read (VALUE scheduler, VALUE io, VALUE buffer, size_t offset, size_t length)
int | rb_scheduler_supports_io_write (VALUE scheduler)
VALUE | rb_scheduler_io_write (VALUE scheduler, VALUE io, VALUE buffer, size_t offset, size_t length)

## Function Documentation

## ◆ Init_Scheduler()

void Init_Scheduler | ( | void |  | ) |

Definition at line 28 of file scheduler.c.

## ◆ rb_scheduler_block()

VALUE rb_scheduler_block | ( | VALUE | scheduler,
|  | VALUE | blocker,
|  | VALUE | timeout
| ) |  |

Definition at line 160 of file scheduler.c.

References rb_funcall().

## ◆ rb_scheduler_close()

VALUE rb_scheduler_close | ( | VALUE | scheduler | ) |

Definition at line 116 of file scheduler.c.

References Qnil, rb_funcall(), and rb_respond_to().

Referenced by rb_scheduler_set().

## ◆ rb_scheduler_current()

VALUE rb_scheduler_current | ( | void |  | ) |

Definition at line 105 of file scheduler.c.

Referenced by rb_io_wait(), rb_io_wait_readable(), rb_io_wait_writable(), rb_mutex_sleep(), rb_process_status_wait(), and rb_wait_for_single_fd().

## ◆ rb_scheduler_get()

VALUE rb_scheduler_get | ( | void |  | ) |

Definition at line 44 of file scheduler.c.

References rb_thread_struct::scheduler, and VM_ASSERT.

## ◆ rb_scheduler_io_read()

VALUE rb_scheduler_io_read | ( | VALUE | scheduler,
|  | VALUE | io,
|  | VALUE | buffer,
|  | size_t | offset,
|  | size_t | length
| ) |  |

Definition at line 196 of file scheduler.c.

References rb_funcall(), and SIZET2NUM.

## ◆ rb_scheduler_io_wait()

VALUE rb_scheduler_io_wait | ( | VALUE | scheduler,
|  | VALUE | io,
|  | VALUE | events,
|  | VALUE | timeout
| ) |  |

Definition at line 172 of file scheduler.c.

References rb_funcall().

Referenced by rb_io_wait(), rb_scheduler_io_wait_readable(), rb_scheduler_io_wait_writable(), and rb_wait_for_single_fd().

## ◆ rb_scheduler_io_wait_readable()

VALUE rb_scheduler_io_wait_readable | ( | VALUE | scheduler,
|  | VALUE | io
| ) |  |

Definition at line 178 of file scheduler.c.

References Qnil, rb_scheduler_io_wait(), RB_UINT2NUM, and RUBY_IO_READABLE.

Referenced by rb_io_wait_readable().

## ◆ rb_scheduler_io_wait_writable()

VALUE rb_scheduler_io_wait_writable | ( | VALUE | scheduler,
|  | VALUE | io
| ) |  |

Definition at line 184 of file scheduler.c.

References Qnil, rb_scheduler_io_wait(), RB_UINT2NUM, and RUBY_IO_WRITABLE.

Referenced by rb_io_wait_writable().

## ◆ rb_scheduler_io_write()

VALUE rb_scheduler_io_write | ( | VALUE | scheduler,
|  | VALUE | io,
|  | VALUE | buffer,
|  | size_t | offset,
|  | size_t | length
| ) |  |

Definition at line 208 of file scheduler.c.

References rb_funcall(), and SIZET2NUM.

## ◆ rb_scheduler_kernel_sleep()

VALUE rb_scheduler_kernel_sleep | ( | VALUE | scheduler,
|  | VALUE | timeout
| ) |  |

Definition at line 136 of file scheduler.c.

References rb_funcall().

Referenced by rb_mutex_sleep().

## ◆ rb_scheduler_kernel_sleepv()

VALUE rb_scheduler_kernel_sleepv | ( | VALUE | scheduler,
|  | int | argc,
|  | VALUE * | argv
| ) |  |

Definition at line 142 of file scheduler.c.

References argc, argv, and rb_funcallv.

## ◆ rb_scheduler_process_wait()

VALUE rb_scheduler_process_wait | ( | VALUE | scheduler,
|  | rb_pid_t | pid,
|  | int | flags
| ) |  |

Definition at line 154 of file scheduler.c.

References PIDT2NUM, rb_funcall(), and RB_INT2NUM.

Referenced by rb_process_status_wait().

## ◆ rb_scheduler_set()

VALUE rb_scheduler_set | ( | VALUE | scheduler | ) |

Definition at line 73 of file scheduler.c.

References Qnil, rb_scheduler_close(), rb_thread_struct::scheduler, and VM_ASSERT.

## ◆ rb_scheduler_supports_io_read()

int rb_scheduler_supports_io_read | ( | VALUE | scheduler | ) |

Definition at line 190 of file scheduler.c.

References rb_respond_to().

## ◆ rb_scheduler_supports_io_write()

int rb_scheduler_supports_io_write | ( | VALUE | scheduler | ) |

Definition at line 202 of file scheduler.c.

References rb_respond_to().

## ◆ rb_scheduler_supports_process_wait()

int rb_scheduler_supports_process_wait | ( | VALUE | scheduler | ) |

Definition at line 148 of file scheduler.c.

References rb_respond_to().

Referenced by rb_process_status_wait().

## ◆ rb_scheduler_timeout()

VALUE rb_scheduler_timeout | ( | struct timeval * | timeout | ) |

Definition at line 126 of file scheduler.c.

References Qnil, rb_float_new, timeval::tv_sec, and timeval::tv_usec.

Referenced by rb_wait_for_single_fd().

## ◆ rb_scheduler_unblock()

VALUE rb_scheduler_unblock | ( | VALUE | scheduler,
|  | VALUE | blocker,
|  | VALUE | fiber
| ) |  |

Definition at line 166 of file scheduler.c.

References rb_funcall().

## ◆ rb_thread_scheduler_current()

VALUE rb_thread_scheduler_current | ( | VALUE | thread | ) |

Definition at line 110 of file scheduler.c.