Sha256: 77c4ab94d3f95a8aca63e6c19afe276db8ed04830bcf094e131215401ce13d87

Contents?: true

Size: 1.17 KB

Versions: 30

Compression:

Stored size: 1.17 KB

Contents

#include <ruby.h>

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

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

VALUE atomic_boolean_allocate(VALUE klass) {
  return rb_data_object_wrap(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

30 entries across 30 versions & 1 rubygems

Version Path
concurrent-ruby-ext-1.3.5-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.5-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.5 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.4-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.4-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.4 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.3-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.3-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.3 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.2-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.2-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.2 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1.pre-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1.pre-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.3.1.pre ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.2.3-x86-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c
concurrent-ruby-ext-1.2.3-x64-mingw32 ext/concurrent-ruby-ext/atomic_boolean.c