Sha256: 09e706cc2d4a19497816089aab7fc7b21729cb4c7282f72c0e7729d6e9302e34

Contents?: true

Size: 816 Bytes

Versions: 23

Compression:

Stored size: 816 Bytes

Contents

#ifndef __allocated_resource
#define __allocated_resource

#include "chain.h"

namespace h8 {

/**
 * Resource that allocates anything that is tied to Isolate and should be
 * freed _before_ isolate is destroyed.
 *
 * (1) derive any of such your resources from it
 * (2) register them in the parent H8 (h8->add_resource())
 * (3) free() resource in free(), then call unlink()/super
 * (4) free all resources in the destructor if any.
 */
class AllocatedResource : public chain::link {
public:
	/**
	 * If your resource references any ruby object, be sure to mark them
	 * all overriding this method!
	 */
	virtual void rb_mark_gc() {};

	virtual void free() {
		unlink();
	};

	/* Default implementation does nothing but call unlink throgh parent
	 * destructor
	 */
	virtual ~AllocatedResource() {};
};

}

#endif

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
h8-0.5.5 ext/h8/allocated_resource.h
h8-0.5.4 ext/h8/allocated_resource.h
h8-0.5.2 ext/h8/allocated_resource.h
h8-0.5.1 ext/h8/allocated_resource.h
h8-0.5.0 ext/h8/allocated_resource.h
h8-0.4.11 ext/h8/allocated_resource.h
h8-0.4.10 ext/h8/allocated_resource.h
h8-0.4.8 ext/h8/allocated_resource.h
h8-0.4.5 ext/h8/allocated_resource.h
h8-0.4.0 ext/h8/allocated_resource.h
h8-0.3.0 ext/h8/allocated_resource.h
h8-0.2.5 ext/h8/allocated_resource.h
h8-0.2.4 ext/h8/allocated_resource.h
h8-0.2.3 ext/h8/allocated_resource.h
h8-0.2.2 ext/h8/allocated_resource.h
h8-0.2.1 ext/h8/allocated_resource.h
h8-0.1.4 ext/h8/allocated_resource.h
h8-0.1.3 ext/h8/allocated_resource.h
h8-0.1.2 ext/h8/allocated_resource.h
h8-0.1.1 ext/h8/allocated_resource.h