Refresh

This website rubydoc.info/gems/ruby-internal/0.8.1/Thread is currently offline. Cloudflare\'s Always Online™ shows a snapshot of this web page from the Internet Archive\'s Wayback Machine. To check for the live version, click Refresh.

Class: Thread

Inherits:
Object show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#cfp=(RubyVM) ⇒ Object

Returns the thread’s control frame.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'ext/internal/thread/thread.c', line 26

static VALUE thread_cfp(VALUE self)
{
  rb_thread_t * th;
  rb_control_frame_t * prev_cfp;

  GetThreadPtr(self, th);

  /* TODO: Not sure how many control frames back to go to get the one we
   * want */
  prev_cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(th->cfp);
  if((void *)(th->stack + th->stack_size) == (void *)prev_cfp)
  {
    return Qnil;
  }
  else
  {
    struct RubyInternalControlFrame * cfp;
    VALUE cfp_v;

    cfp_v = Data_Make_Struct(
        rb_cVmControlFrame,
        struct RubyInternalControlFrame,
        mark_ruby_internal_control_frame,
        free, 
        cfp);

    cfp->control_frame = prev_cfp;
    cfp->thread = self;

    return cfp_v;
  }
}