Class: Readapt::Thread

Inherits:
Object
  • Object
show all
Defined in:
lib/readapt/thread.rb,
ext/readapt/threads.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#controlSymbol

Returns:

  • (Symbol)


8
9
10
# File 'lib/readapt/thread.rb', line 8

def control
  @control
end

Class Method Details

.allObject



124
125
126
127
# File 'ext/readapt/threads.c', line 124

static VALUE thread_all_s(VALUE self)
{
	return rb_funcall(threads, rb_intern("values"), 0);
}

.find(id) ⇒ Object



129
130
131
132
# File 'ext/readapt/threads.c', line 129

static VALUE thread_find_s(VALUE self, VALUE id)
{
	return thread_reference_id(id);
}

.include?(id) ⇒ Boolean

Returns:

  • (Boolean)


134
135
136
137
# File 'ext/readapt/threads.c', line 134

static VALUE thread_include_s(VALUE self, VALUE id)
{
	return rb_funcall(ids, rb_intern("include?"), 1, id);
}

Instance Method Details

#framesObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'ext/readapt/threads.c', line 145

static VALUE frames_m(VALUE self)
{
	thread_reference_t *data;
	VALUE ary;
	VALUE frm;
	int i;
	frame_t *fd;

	ary = rb_ary_new();
	data = thread_reference_pointer(self);
	for (i = data->frames->size - 1; i >= 0; i--)
	{
		fd = data->frames->elements[i];
		// TODO This condition should probably not be necessary.
		if (fd->binding != Qnil)
		{
			frm = frame_new_from_data(fd);
			rb_ary_push(ary, frm);
		}
	}

	return ary;
}

#idObject



139
140
141
142
143
# File 'ext/readapt/threads.c', line 139

static VALUE thread_id_m(VALUE self)
{
	thread_reference_t *data = thread_reference_pointer(self);
	return LONG2NUM(data->id);
}

#nameString

Returns:

  • (String)


11
12
13
# File 'lib/readapt/thread.rb', line 11

def name
  @name ||= "Thread #{id}"
end

#objectObject

# @return [Object]



16
17
18
# File 'lib/readapt/thread.rb', line 16

def object
  ObjectSpace._id2ref(thread_object_id)
end

#thread_object_idObject



169
170
171
172
173
174
175
176
# File 'ext/readapt/threads.c', line 169

static VALUE thread_object_id_m(VALUE self)
{
	thread_reference_t *data;

    data = thread_reference_pointer(self);
    return LONG2NUM(data->thread_object_id);
    // return rb_hash_aref(ids, INT2NUM(data->id))->object_id;
}