summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-16 10:39:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-16 10:39:21 +0000
commitd5db6fd46ef39538766493e1221ca070cff26148 (patch)
treee35bec6817292342a5741d5558faf39d13b35aac
parentddd90c76e150f88ffb1a64f591dcefee8afa1f56 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog2
-rw-r--r--eval.c2
-rw-r--r--ext/tcltklib/tcltklib.c14
-rw-r--r--lib/tk.rb11
-rw-r--r--sample/tkline.rb1
5 files changed, 11 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index bfead7e5edd..4187c0612ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
Thu Apr 16 16:52:01 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
+ * lib/tk.rb: thread support (experimental - maybe slow).
+
* eval.c (rb_longjmp): trace event on exception in raising
context, just before raising exception.
diff --git a/eval.c b/eval.c
index ede12a9a242..e2905deb018 100644
--- a/eval.c
+++ b/eval.c
@@ -3520,7 +3520,7 @@ rb_call(klass, recv, mid, argc, argv, scope)
VALUE *argv; /* OK */
int scope;
{
- NODE *body; /* OK */
+ NODE *body; /* OK */
int noex;
ID id = mid;
struct cache_entry *ent;
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index 6bebb88f9b7..aa2cf71be0e 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -33,23 +33,13 @@ int *tclDummyMathPtr = (int *) matherr;
/*---- module TclTkLib ----*/
-static VALUE thread_safe = Qnil;
-
/* execute Tk_MainLoop */
static VALUE
lib_mainloop(VALUE self)
{
- int old_trapflg;
- int flags = RTEST(thread_safe)?TCL_DONT_WAIT:0;
-
DUMP1("start Tk_Mainloop");
while (Tk_GetNumMainWindows() > 0) {
- old_trapflg = trap_immediate;
- trap_immediate = 1;
- Tcl_DoOneEvent(flags);
- trap_immediate = old_trapflg;
- CHECK_INTS;
- flags = (thread_safe == 0 || thread_safe == Qnil)?0:TCL_DONT_WAIT;
+ Tcl_DoOneEvent(0);
}
DUMP1("stop Tk_Mainloop");
@@ -210,8 +200,6 @@ void Init_tcltklib()
/* from Tk_Main() */
DUMP1("Tcl_FindExecutable");
Tcl_FindExecutable(RSTRING(rb_argv0)->ptr);
-
- rb_define_variable("$tk_thread_safe", &thread_safe);
}
/* eof */
diff --git a/lib/tk.rb b/lib/tk.rb
index b932696290b..b10274100d2 100644
--- a/lib/tk.rb
+++ b/lib/tk.rb
@@ -268,6 +268,13 @@ module TkCore
end
def mainloop
+ if defined?(Thread)
+ INTERP._eval("proc rb_after {} {
+ ruby {Thread.pass};
+ after 200 rb_after
+ }")
+ INTERP._eval("rb_after")
+ end
TclTkLib.mainloop
end
@@ -317,10 +324,6 @@ module Tk
tk_call 'bell'
end
- def mainloop
- TclTkLib.mainloop
- end
-
module Scrollable
def xscrollcommand(cmd=Proc.new)
configure_cmd 'xscrollcommand', cmd
diff --git a/sample/tkline.rb b/sample/tkline.rb
index 63d763a680f..2406b0749ff 100644
--- a/sample/tkline.rb
+++ b/sample/tkline.rb
@@ -1,5 +1,4 @@
-$tk_thread_safe = TRUE
require "tkclass"
$tkline_init = FALSE