Project

General

Profile

Feature #20750 » 11618.patch

Old Solution - kbrock (Keenan Brock), 09/17/2024 04:52 PM

View differences:

error.c
#include "internal/process.h"
#include "internal/string.h"
#include "internal/symbol.h"
#include "internal/thread.h"
#include "internal/variable.h"
#include "ruby/encoding.h"
#include "ruby/st.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby_assert.h"
#include "vm_core.h"
ext/fiddle/closure.c
#include <stdbool.h>
#include <ruby/thread.h>
int ruby_thread_has_gvl_p(void); /* from internal.h */
VALUE cFiddleClosure;
typedef struct {
gc/default.c
return (void *)(VALUE)garbage_collect(oar->objspace, oar->reason);
}
int ruby_thread_has_gvl_p(void);
static int
garbage_collect_with_gvl(rb_objspace_t *objspace, unsigned int reason)
{
include/ruby/thread.h
RBIMPL_SYMBOL_EXPORT_BEGIN()
/**
* Check if current native thread has GVL.
* @return 1 if the current thread has acquired the GVL.
*
* Usage:
* if (ruby_thread_has_gvl_p()) {
* method_call(&context);
* }
* else {
* rb_thread_call_with_gvl(method_call, &context);
* }
*/
int ruby_thread_has_gvl_p(void);
RBIMPL_ATTR_NONNULL((1))
/**
* (Re-)acquires the GVL. This manoeuvre makes it possible for an out-of-GVL
internal/thread.h
VALUE rb_thread_io_blocking_region(rb_blocking_function_t *func, void *data1, int fd);
VALUE rb_thread_io_blocking_call(rb_blocking_function_t *func, void *data1, int fd, int events);
/* thread.c (export) */
int ruby_thread_has_gvl_p(void); /* for ext/fiddle/closure.c */
RUBY_SYMBOL_EXPORT_END
int rb_threadptr_execute_interrupts(struct rb_thread_struct *th, int blocking_timing);
thread.c
/*
* ruby_thread_has_gvl_p - check if current native thread has GVL.
*
***
*** This API is EXPERIMENTAL!
*** We do not guarantee that this API remains in ruby 1.9.2 or later.
***
*/
int
(1-1/3)