Ruby: internal/concurrent_set.h Source File

Ruby 4.0.6p0 (2026-07-14 revision 03b6d3f8898a28604fe6cb00eae3226b821168f4)

concurrent_set.h
1#ifndef RUBY_RACTOR_SAFE_TABLE_H
2#define RUBY_RACTOR_SAFE_TABLE_H
3
4#include "ruby/atomic.h"
5#include "ruby/ruby.h"
6
7 struct rb_concurrent_set_funcs {
8 VALUE (*hash)(VALUE key);
9 bool (*cmp)(VALUE a, VALUE b);
10 VALUE (*create)(VALUE key, void *data);
11 void (*free)(VALUE key);
12};
13
14 VALUE rb_concurrent_set_new(const struct rb_concurrent_set_funcs *funcs, int capacity);
15 rb_atomic_t rb_concurrent_set_size(VALUE set_obj);
16 VALUE rb_concurrent_set_find(VALUE *set_obj_ptr, VALUE key);
17 VALUE rb_concurrent_set_find_or_insert(VALUE *set_obj_ptr, VALUE key, void *data);
18 VALUE rb_concurrent_set_delete_by_identity(VALUE set_obj, VALUE key);
19void rb_concurrent_set_foreach_with_replace(VALUE set_obj, int (*callback)(VALUE *key, void *data), void *data);
20
21#endif
atomic.h
Atomic operations.
rb_atomic_t
std::atomic< unsigned > rb_atomic_t
Type that is eligible for atomic operations.
Definition atomic.h:69
ruby.h
rb_concurrent_set_funcs
Definition concurrent_set.h:7
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40