Module: FFI::Tcl
- Extended by:
- Library
- Defined in:
- lib/ffi-tk/ffi/tcl.rb,
lib/ffi-tk/ffi/tcl/obj.rb,
lib/ffi-tk/ffi/tcl/time.rb,
lib/ffi-tk/ffi/tcl/interp.rb,
lib/ffi-tk/ffi/tcl/cmd_proc.rb,
lib/ffi-tk/ffi/tcl/eval_result.rb
Defined Under Namespace
Classes: CmdProc, EvalResult, Interp, Obj, ObjType, PrettyStruct, TclTime
Constant Summary
collapse
- ATTACHED_FUNCTIONS =
{}
- BINDING =
binding
Class Method Summary
collapse
Class Method Details
.setup_eventloop_on_main_thread ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/ffi-tk/ffi/tcl.rb', line 76
def setup_eventloop_on_main_thread
puts "Run eventloop on main thread" if $DEBUG
code = "def self.%s(*args, &block)\n %s(*args, &block)\nend\n RUBY\n\n binding, file, line = BINDING, __FILE__, __LINE__ - 5\n ATTACHED_FUNCTIONS.each do |function, ruby_name|\n eval(code % [ruby_name, function], binding, file, line)\n end\n\n Interp.new(create_interp)\nend\n".strip
|
.setup_eventloop_on_new_thread ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/ffi-tk/ffi/tcl.rb', line 57
def setup_eventloop_on_new_thread
puts "Run eventloop on new thread" if $DEBUG
code = "def self.%s(*args, &block)\n @thread_sender.thread_send{ %s(*args, &block) }\nend\n RUBY\n\n binding, file, line = BINDING, __FILE__, __LINE__ - 5\n ATTACHED_FUNCTIONS.each do |function, ruby_name|\n eval(code % [ruby_name, function], binding, file, line)\n end\n\n @thread_sender = ThreadSender.new\n class << self; attr_reader :thread_sender; end\n @thread_sender.thread_send{ Interp.new(create_interp) }\nend\n".strip
|