Sha256: 81899991ce0b31b58734eb55e56750f0245bfdc5d8d2a36c602711468e85283f

Contents?: true

Size: 1.81 KB

Versions: 8

Compression:

Stored size: 1.81 KB

Contents

/* 
 * Copyright (C) 2010 Rocky Bernstein
 */
#if 0  /* The following is to fake out rdoc, until I find a better fix. */
/* 
 *  Additions to the RubyVM::Method class
 */
VALUE rb_cThread = rb_define_class("Method", ...)
#endif

#include "../include/vm_core_mini.h"   /* Pulls in ruby.h and node.h */
#include "thread_extra.h"

/* 
 *  call-seq:
 *  Thread#exec_event_tracing -> bool
 *
 *  Returns the value of the thread event-hook tracing.
 */
VALUE
thread_exec_event_tracing(VALUE self)
{
    rb_thread_t *th;
    GetThreadPtr(self, th);
    return th->exec_event_tracing ? Qtrue : Qfalse;
}

/* 
 *  call-seq:
 *  Thread#exec_event_tracing=(new_value)
 * 
 *  Sets the value of thread event-hook tracing.
 */
VALUE
thread_exec_event_tracing_set(VALUE self, VALUE new_value)
{
    rb_thread_t *th;
    GetThreadPtr(self, th);

    th->exec_event_tracing = RTEST(new_value) ? Qtrue : Qfalse;
    return th->exec_event_tracing;
}

/* 
 *  call-seq:
 *  Thread#tracing -> bool
 * 
 *  Returns the value of the thread event-hook tracing.
 */
VALUE
thread_tracing(VALUE self)
{
    rb_thread_t *th;
    GetThreadPtr(self, th);
    return th->tracing ? Qtrue : Qfalse;
}

/* 
 *  call-seq:
 *  Thread#tracing= bool
 * 
 *  Sets the value of thread event-hook tracing.
 */
VALUE
thread_tracing_set(VALUE self, VALUE new_value)
{
    rb_thread_t *th;
    GetThreadPtr(self, th);

    th->tracing = RTEST(new_value) ? Qtrue : Qfalse;
    return th->tracing;
}

void
Init_thread_extra(void)
{
    /* Additions to Thread class */
    rb_define_method(rb_cThread, "exec_event_tracing=",  
		     thread_exec_event_tracing_set, 1);
    rb_define_method(rb_cThread, "exec_event_tracing",   
		     thread_exec_event_tracing, 0);
    rb_define_method(rb_cThread, "tracing=",  thread_tracing_set, 1);
    rb_define_method(rb_cThread, "tracing",   thread_tracing, 0);
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rb-threadframe-0.39 ext/thread_extra.c
rb-threadframe-0.38 ext/thread_extra.c
rb-threadframe-0.37 ext/thread_extra.c
rb-threadframe-0.36 ext/thread_extra.c
rb-threadframe-0.35 ext/thread_extra.c
rb-threadframe-0.34 ext/thread_extra.c
rb-threadframe-0.33 ext/thread_extra.c
rb-threadframe-0.32 ext/thread_extra.c