Rice  2.1.1
Public Member Functions | Static Public Member Functions | List of all members
Rice::Address_Registration_Guard Class Reference

A guard to register a given address with the GC. More...

#include <Address_Registration_Guard_defn.hpp>

Inheritance diagram for Rice::Address_Registration_Guard:

Public Member Functions

 Address_Registration_Guard (VALUE *address)
 Register an address with the GC.
 Address_Registration_Guard (Object *object)
 Register an Object with the GC. More...
 ~Address_Registration_Guard ()
 Unregister an address/Object with the GC. More...
VALUE * address () const
 Get the address that is registered with the GC.
void swap (Address_Registration_Guard &other)
 Swap with another Address_Registration_Guard.

Static Public Member Functions

static void disable ()

Detailed Description

A guard to register a given address with the GC.

Calls rb_gc_register_address upon construction and rb_gc_unregister_address upon destruction. For example:

Class Foo
: string_(rb_str_new2())
, guard_(&string_);
VALUE string_;

Constructor & Destructor Documentation

§ Address_Registration_Guard()

Rice::Address_Registration_Guard::Address_Registration_Guard ( Object object)

Register an Object with the GC.

objectThe Object to register with the GC. The object must not be destroyed before the Address_Registration_Guard is destroyed.

§ ~Address_Registration_Guard()

Rice::Address_Registration_Guard::~Address_Registration_Guard ( )

Unregister an address/Object with the GC.

Destruct an Address_Registration_Guard. The address registered with the Address_Registration_Guard when it was constructed will be unregistered from the GC.

Member Function Documentation

§ disable()

static void Rice::Address_Registration_Guard::disable ( )

Called during Ruby's exit process since we should not call rb_gc unregister_address there

The documentation for this class was generated from the following file: