mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
fix public interface
To make some kind of Ractor related extensions, some functions should be exposed. * include/ruby/thread_native.h * rb_native_mutex_* * rb_native_cond_* * include/ruby/ractor.h * RB_OBJ_SHAREABLE_P(obj) * rb_ractor_shareable_p(obj) * rb_ractor_std*() * rb_cRactor and rm ractor_pub.h and rename srcdir/ractor.h to srcdir/ractor_core.h (to avoid conflict with include/ruby/ractor.h)
This commit is contained in:
parent
0683912db8
commit
5e3259ea74
Notes:
git
2020-11-18 03:53:22 +09:00
23 changed files with 121 additions and 135 deletions
|
@ -31,10 +31,14 @@ typedef union rb_thread_lock_union {
|
|||
CRITICAL_SECTION crit;
|
||||
} rb_nativethread_lock_t;
|
||||
|
||||
typedef struct rb_thread_cond_struct rb_nativethread_cond_t;
|
||||
|
||||
#elif defined(HAVE_PTHREAD_H)
|
||||
|
||||
#include <pthread.h>
|
||||
typedef pthread_t rb_nativethread_id_t;
|
||||
typedef pthread_mutex_t rb_nativethread_lock_t;
|
||||
typedef pthread_cond_t rb_nativethread_cond_t;
|
||||
|
||||
#else
|
||||
#error "unsupported thread type"
|
||||
|
@ -50,6 +54,19 @@ void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
|
|||
void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock);
|
||||
void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock);
|
||||
|
||||
void rb_native_mutex_lock(rb_nativethread_lock_t *lock);
|
||||
int rb_native_mutex_trylock(rb_nativethread_lock_t *lock);
|
||||
void rb_native_mutex_unlock(rb_nativethread_lock_t *lock);
|
||||
void rb_native_mutex_initialize(rb_nativethread_lock_t *lock);
|
||||
void rb_native_mutex_destroy(rb_nativethread_lock_t *lock);
|
||||
|
||||
void rb_native_cond_signal(rb_nativethread_cond_t *cond);
|
||||
void rb_native_cond_broadcast(rb_nativethread_cond_t *cond);
|
||||
void rb_native_cond_wait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex);
|
||||
void rb_native_cond_timedwait(rb_nativethread_cond_t *cond, rb_nativethread_lock_t *mutex, unsigned long msec);
|
||||
void rb_native_cond_initialize(rb_nativethread_cond_t *cond);
|
||||
void rb_native_cond_destroy(rb_nativethread_cond_t *cond);
|
||||
|
||||
RUBY_SYMBOL_EXPORT_END
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue