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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/ffi-tk/ffi/tcl.rb', line 87
def setup_eventloop_on_main_thread
puts "Run eventloop on main thread" if $DEBUG
code = <<-'RUBY'.strip
def self.%s(*args, &block)
%s(*args, &block)
end
RUBY
binding, file, line = BINDING, __FILE__, __LINE__ - 5
ATTACHED_FUNCTIONS.each do |function, ruby_name|
eval(code % [ruby_name, function], binding, file, line)
end
Interp.new(create_interp)
end
|
.setup_eventloop_on_new_thread ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# File 'lib/ffi-tk/ffi/tcl.rb', line 68
def setup_eventloop_on_new_thread
puts "Run eventloop on new thread" if $DEBUG
code = <<-RUBY.strip
def self.%s(*args, &block)
@thread_sender.thread_send{ %s(*args, &block) }
end
RUBY
binding, file, line = BINDING, __FILE__, __LINE__ - 5
ATTACHED_FUNCTIONS.each do |function, ruby_name|
eval(code % [ruby_name, function], binding, file, line)
end
@thread_sender = ThreadSender.new
class << self; attr_reader :thread_sender; end
@thread_sender.thread_send{ Interp.new(create_interp) }
end
|