Ruby 1.9.3p327(2012-11-10revision37606)
|
00001 /* -*-c-*- 00002 THIS FILE WAS AUTOGENERATED BY tool/compile_prelude.rb. DO NOT EDIT. 00003 00004 sources: prelude 00005 */ 00006 #include "ruby/ruby.h" 00007 #include "internal.h" 00008 #include "vm_core.h" 00009 00010 00011 static const char prelude_name0[] = "<internal:prelude>"; 00012 static const char prelude_code0[] = 00013 "class Mutex\n" 00014 " # call-seq:\n" 00015 " # mutex.synchronize { ... }\n" 00016 " #\n" 00017 " # Obtains a lock, runs the block, and releases the lock when the\n" 00018 " # block completes. See the example under Mutex.\n" 00019 " def synchronize\n" 00020 " self.lock\n" 00021 " begin\n" 00022 " yield\n" 00023 " ensure\n" 00024 " self.unlock rescue nil\n" 00025 " end\n" 00026 " end\n" 00027 "end\n" 00028 "\n" 00029 "class Thread\n" 00030 " MUTEX_FOR_THREAD_EXCLUSIVE = Mutex.new # :nodoc:\n" 00031 "\n" 00032 " # call-seq:\n" 00033 " # Thread.exclusive { block } => obj\n" 00034 " #\n" 00035 " # Wraps a block in Thread.critical, restoring the original value\n" 00036 " # upon exit from the critical section, and returns the value of the\n" 00037 " # block.\n" 00038 " def self.exclusive\n" 00039 " MUTEX_FOR_THREAD_EXCLUSIVE.synchronize{\n" 00040 " yield\n" 00041 " }\n" 00042 " end\n" 00043 "end\n" 00044 ; 00045 00046 #define PRELUDE_COUNT 0 00047 00048 00049 static void 00050 prelude_eval(VALUE code, VALUE name, VALUE line) 00051 { 00052 rb_iseq_eval(rb_iseq_compile_with_option(code, name, Qnil, line, Qtrue)); 00053 } 00054 00055 void 00056 Init_prelude(void) 00057 { 00058 prelude_eval( 00059 rb_usascii_str_new(prelude_code0, sizeof(prelude_code0) - 1), 00060 rb_usascii_str_new(prelude_name0, sizeof(prelude_name0) - 1), 00061 INT2FIX(1)); 00062 00063 #if 0 00064 puts(prelude_code0); 00065 #endif 00066 } 00067