diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-17 09:29:36 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-04-17 09:29:36 +0000 |
commit | 4c97b921f2f6d71d7a3f2c0b2c0c089b15686973 (patch) | |
tree | 7c0bd6b3abad22d25c3014052fd72a58ea07be51 /ext | |
parent | 693efbb71035dede6459e0e5b73a5acdf38e5d90 (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/extmk.rb.in | 2 | ||||
-rw-r--r-- | ext/tcltklib/tcltklib.c | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index fbc455840c..0dae66b874 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -67,7 +67,7 @@ LINK = "@CC@ -o conftest -I#{$topdir} " + CFLAGS + " %s @LDFLAGS@ %s conftest.c CPP = "@CPP@ @CPPFLAGS@ -I#{$topdir} " + CFLAGS + " %s conftest.c" end -if /win32|djgpp|mingw32/i =~ PLATFORM +if /win32|djgpp|mingw32|m68k-human/i =~ PLATFORM $null = open("nul", "w") else $null = open("/dev/null", "w") diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index aa2cf71be0..058fe94042 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -33,16 +33,52 @@ int *tclDummyMathPtr = (int *) matherr; /*---- module TclTkLib ----*/ +/* Tk_ThreadTimer */ +typedef struct { + Tcl_TimerToken token; + int flag; +} Tk_ThreadTimerData; + +/* timer callback */ +void _timer_for_thread (ClientData clientData) +{ + Tk_ThreadTimerData *timer = (Tk_ThreadTimerData *) clientData; + + timer->flag = 0; + CHECK_INTS; +#ifdef THREAD + if (!thread_critical) thread_schedule(); +#endif + + timer->token = Tk_CreateTimerHandler(200, _timer_for_thread, + (ClientData) timer); + timer->flag = 1; +} + /* execute Tk_MainLoop */ static VALUE lib_mainloop(VALUE self) { + Tk_ThreadTimerData *timer; + + timer = (Tk_ThreadTimerData *) ckalloc(sizeof(Tk_ThreadTimerData)); + timer->flag = 0; + timer->token = Tk_CreateTimerHandler(200, _timer_for_thread, + (ClientData) timer); + timer->flag = 1; + DUMP1("start Tk_Mainloop"); while (Tk_GetNumMainWindows() > 0) { Tcl_DoOneEvent(0); } DUMP1("stop Tk_Mainloop"); +#ifdef THREAD + if (timer->flag) { + Tk_DeleteTimerHandler(timer->token); + } +#endif + return Qnil; } |