Sha256: 2c8802bf1ed3f97167d89ec03c6f2ff81687095a52a44b3d04ba5071a8d15b5f

Contents?: true

Size: 1.2 KB

Versions: 46

Compression:

Stored size: 1.2 KB

Contents

#include <ruby.h>

#include "atomic_boolean.h"
#include "atomic_reference.h"
#include "ruby_193_compatible.h"

void atomic_boolean_mark(void *value) {
  rb_gc_mark_maybe((VALUE) value);
}

VALUE atomic_boolean_allocate(VALUE klass) {
  return rb_data_object_alloc(klass, (void *) Qfalse, atomic_boolean_mark, NULL);
}

VALUE method_atomic_boolean_initialize(int argc, VALUE* argv, VALUE self) {
  VALUE value = Qfalse;
  rb_check_arity(argc, 0, 1);
  if (argc == 1) value = TRUTHY(argv[0]);
  DATA_PTR(self) = (void *) value;
  return(self);
}

VALUE method_atomic_boolean_value(VALUE self) {
  return(ir_get(self));
}

VALUE method_atomic_boolean_value_set(VALUE self, VALUE value) {
  VALUE new_value = TRUTHY(value);
  return(ir_set(self, new_value));
}

VALUE method_atomic_boolean_true_question(VALUE self) {
  return(method_atomic_boolean_value(self));
}

VALUE method_atomic_boolean_false_question(VALUE self) {
  VALUE current = method_atomic_boolean_value(self);
  return(current == Qfalse ? Qtrue : Qfalse);
}

VALUE method_atomic_boolean_make_true(VALUE self) {
  return(ir_compare_and_set(self, Qfalse, Qtrue));
}

VALUE method_atomic_boolean_make_false(VALUE self) {
  return(ir_compare_and_set(self, Qtrue, Qfalse));
}

Version data entries

46 entries across 46 versions & 2 rubygems

Version Path
concurrent-ruby-ext-1.1.9-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.9-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.9 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.8-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.8-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.8 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.7-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.7-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.7 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6.pre1-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6.pre1-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.1.6.pre1 ext/concurrent-ruby-ext/atomic_boolean.c
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/concurrent-ruby-ext-1.1.5/ext/concurrent-ruby-ext/atomic_boolean.c
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/concurrent-ruby-ext-1.1.5/ext/concurrent-ruby-ext/atomic_boolean.c
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/concurrent-ruby-ext-1.1.5/ext/concurrent-ruby-ext/atomic_boolean.c
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/concurrent-ruby-ext-1.1.5/ext/concurrent-ruby-ext/atomic_boolean.c
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/concurrent-ruby-ext-1.1.5/ext/concurrent-ruby-ext/atomic_boolean.c