Skip to content

Commit

Permalink
WIP: support --with-coroutine=pthread
Browse files Browse the repository at this point in the history
disable MN
  • Loading branch information
ko1 committed Sep 27, 2023
1 parent 45ae0e0 commit ca49f45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions thread_pthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ thread_sched_readyq_contain_p(struct rb_thread_sched *sched, rb_thread_t *th)
static rb_thread_t *
thread_sched_deq(struct rb_thread_sched *sched)
{
ASSERT_thread_sched_locked(sched, NULL);
rb_thread_t *next_th;

VM_ASSERT(sched->running != NULL);
Expand All @@ -687,6 +688,7 @@ thread_sched_deq(struct rb_thread_sched *sched)
static void
thread_sched_enq(struct rb_thread_sched *sched, rb_thread_t *ready_th)
{
ASSERT_thread_sched_locked(sched, NULL);
RUBY_DEBUG_LOG("ready_th:%u readyq_cnt:%d", rb_th_serial(ready_th), sched->readyq_cnt);

VM_ASSERT(sched->running != NULL);
Expand Down Expand Up @@ -2642,7 +2644,7 @@ static struct {

int comm_fds[2]; // r, w

#if HAVE_SYS_EPOLL_H
#if HAVE_SYS_EPOLL_H && USE_MN_THREADS
#define EPOLL_EVENTS_MAX 0x10
int epoll_fd;
struct epoll_event finished_events[EPOLL_EVENTS_MAX];
Expand Down Expand Up @@ -2929,7 +2931,7 @@ rb_thread_create_timer_thread(void)
RUBY_DEBUG_LOG("forked child process");

CLOSE_INVALIDATE_PAIR(timer_th.comm_fds);
#if HAVE_SYS_EPOLL_H
#if HAVE_SYS_EPOLL_H && USE_MN_THREADS
close_invalidate(&timer_th.epoll_fd, "close epoll_fd");
#endif
rb_native_mutex_destroy(&timer_th.waiting_lock);
Expand Down Expand Up @@ -3021,7 +3023,7 @@ rb_reserved_fd_p(int fd)

if (fd == timer_th.comm_fds[0] ||
fd == timer_th.comm_fds[1]
#if HAVE_SYS_EPOLL_H
#if HAVE_SYS_EPOLL_H && USE_MN_THREADS
|| fd == timer_th.epoll_fd
#endif
) {
Expand Down
2 changes: 1 addition & 1 deletion thread_pthread_mn.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ thread_sched_wait_events(struct rb_thread_sched *sched, rb_thread_t *th, int fd,
#endif // USE_MN_THREADS

/// EPOLL specific code
#if HAVE_SYS_EPOLL_H
#if HAVE_SYS_EPOLL_H && USE_MN_THREADS

static bool
fd_readable_nonblock(int fd)
Expand Down

0 comments on commit ca49f45

Please sign in to comment.