Ruby
1.9.3p392(2013-02-22revision39386)
Main Page
Modules
Data Structures
Files
File List
Globals
miniprelude.c
Go to the documentation of this file.
1
/* -*-c-*-
2
THIS FILE WAS AUTOGENERATED BY tool/compile_prelude.rb. DO NOT EDIT.
3
4
sources: prelude
5
*/
6
#include "
ruby/ruby.h
"
7
#include "
internal.h
"
8
#include "
vm_core.h
"
9
10
11
static
const
char
prelude_name0
[] =
"<internal:prelude>"
;
12
static
const
char
prelude_code0
[] =
13
"class Mutex\n"
14
" # call-seq:\n"
15
" # mutex.synchronize { ... }\n"
16
" #\n"
17
" # Obtains a lock, runs the block, and releases the lock when the\n"
18
" # block completes. See the example under Mutex.\n"
19
" def synchronize\n"
20
" self.lock\n"
21
" begin\n"
22
" yield\n"
23
" ensure\n"
24
" self.unlock rescue nil\n"
25
" end\n"
26
" end\n"
27
"end\n"
28
"\n"
29
"class Thread\n"
30
" MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new # :nodoc:\n"
31
"\n"
32
" # call-seq:\n"
33
" # Thread.exclusive { block } => obj\n"
34
" #\n"
35
" # Wraps a block in Thread.critical, restoring the original value\n"
36
" # upon exit from the critical section, and returns the value of the\n"
37
" # block.\n"
38
" def self.exclusive\n"
39
" MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{\n"
40
" yield\n"
41
" }\n"
42
" end\n"
43
"end\n"
44
;
45
46
#define PRELUDE_COUNT 0
47
48
49
static
void
50
prelude_eval
(
VALUE
code,
VALUE
name
,
VALUE
line)
51
{
52
rb_iseq_eval
(
rb_iseq_compile_with_option
(code, name,
Qnil
, line,
Qtrue
));
53
}
54
55
void
56
Init_prelude
(
void
)
57
{
58
prelude_eval
(
59
rb_usascii_str_new
(
prelude_code0
,
sizeof
(
prelude_code0
) - 1),
60
rb_usascii_str_new
(
prelude_name0
,
sizeof
(
prelude_name0
) - 1),
61
INT2FIX
(1));
62
63
#if 0
64
puts(
prelude_code0
);
65
#endif
66
}
67
Generated on Tue Feb 26 2013 08:43:03 for Ruby by
1.8.3