[#30455] a[] += 1 で SEGV — "Hiroki Motoyoshi" <himotoyoshi.ml@...>
本吉と申します。
6 messages
2007/03/01
[#30477] ThreadError on shell.rb — "Akira ODA" <oda.org@...>
はじめまして、尾田といいます。
8 messages
2007/03/04
[#30478] Re: ThreadError on shell.rb
— keiju@... (石塚圭樹)
2007/03/04
けいじゅ@いしつかです.
[#30482] Ruby 1.8.6 preview3 has been released — "Akinori MUSHA" <knu@...>
Ruby 1.8.6 preview3 をリリースしました。
10 messages
2007/03/04
[#30489] Re: Ruby 1.8.6 preview3 has been released
— nekomaho <nekomaho@...>
2007/03/05
ねこまほです.
[#30486] str.lines[1..-1] — Minero Aoki <aamine@...>
青木です。
7 messages
2007/03/05
[#30487] Time#to_s format — OHARA Shigeki <os@...>
大原です。
6 messages
2007/03/05
[#30504] num_tとthread_initという名前について — "Yutaka Kanemoto" <kinpoco@...>
金本ともうします。
1 message
2007/03/07
[#30505] [BUG?] SIGTERM の取り扱い — Hidetoshi NAGAI <nagai@...>
永井@知能.九工大です.
10 messages
2007/03/08
[#30509] Re: [BUG?] SIGTERM の取り扱い
— Nobuyoshi Nakada <nobu@...>
2007/03/08
なかだです。
[#30510] Re: [BUG?] SIGTERM の取り扱い
— Yukihiro Matsumoto <matz@...>
2007/03/08
まつもと ゆきひろです
[#30531] DL::PtrData#to_a dumps core — sheepman <sheepman@...>
こんばんは、sheepman です。
4 messages
2007/03/11
[#30532] DL::PtrData#inspect — sheepman <sheepman@...>
こんばんは、sheepman です。
6 messages
2007/03/11
[#30537] Microsoft-IIS 上で cgi.rb がレスポンス行を2重に出力する — MIYASAKA Masaru <alkaid@...>
初めての投稿です。みやさか と申します。よろしくお願いいたします。
5 messages
2007/03/12
[#30549] [ANN] Ruby 1.8.6 has been released — "Akinori MUSHA" <knu@...>
Ruby 1.8.6 をリリースしました。
14 messages
2007/03/12
[#30555] Re: [ANN] Ruby 1.8.6 has been released
— "U.Nakamura" <usa@...>
2007/03/13
こんにちは、なかむら(う)です。
[#30558] Re: [ANN] Ruby 1.8.6 has been released
— moonwolf@...
2007/03/13
おひさしぶり、MoonWolfです。
[#30559] Re: [ANN] Ruby 1.8.6 has been released
— nekomaho <nekomaho@...>
2007/03/13
ねこまほです.
[#30553] help: lib/shell for ruby 1.9 — keiju@... (Keiju ISHITSUKA)
けいじゅ@いしつかです.
13 messages
2007/03/13
[#30585] Re: help: lib/shell for ruby 1.9
— Yukihiro Matsumoto <matz@...>
2007/03/15
まつもと ゆきひろです
[#30587] Re: help: lib/shell for ruby 1.9
— keiju@... (石塚圭樹)
2007/03/15
けいじゅ@いしつかです.
[#30588] Re: help: lib/shell for ruby 1.9
— Yukihiro Matsumoto <matz@...>
2007/03/15
まつもと ゆきひろです
[#30590] [BUG?] Mutex or ConditionVariable for ruby 1.8[Re: Re: help: lib/shell for ruby 1.9]
— keiju@... (石塚圭樹)
2007/03/15
けいじゅ@いしつかです.
[#30592] Re: [BUG?] Mutex or ConditionVariable for ruby 1.8[Re: Re: help: lib/shell for ruby 1.9]
— "Akinori MUSHA" <knu@...>
2007/03/15
At Thu, 15 Mar 2007 18:53:46 +0900,
[#30600] Re: [BUG?] Mutex or ConditionVariable for ruby 1.8[Re: Re: help: lib/shell for ruby 1.9]
— "Akinori MUSHA" <knu@...>
2007/03/16
At Thu, 15 Mar 2007 19:18:42 +0900,
[#30601] Re: [BUG?] Mutex or ConditionVariable for ruby 1.8[Re: Re: help: lib/shell for ruby 1.9]
— keiju@... (keiju ISHITSUKA)
2007/03/16
けいじゅ@いしつかです.
[#30564] release code and revision number — Nobuyoshi Nakada <nobu@...>
なかだです。
11 messages
2007/03/13
[#30566] Re: release code and revision number
— Urabe Shyouhei <shyouhei@...>
2007/03/14
卜部です
[#30581] [ruby-core:10580] Thread後のexecでENOTSUPPエラー対応 — "H.Holon" <holon@...>
相馬 - H.Holonです。
8 messages
2007/03/14
[#30646] Re: [ruby-core:10580] Thread後のexecでENOTSUPPエラー対応
— Nobuyoshi Nakada <nobu@...>
2007/03/19
なかだです。
[#30586] Etc.getgrgid が getgid の値に固定されています — 植田裕之 <ueda@...>
植田と申します。
5 messages
2007/03/15
[#30593] [BUG] waitpid for ruby-trunk — keiju@... (Keiju ISHITSUKA)
けいじゅ@いしつかです.
5 messages
2007/03/15
[#30612] stdout flush in fork — keiju@... (Keiju ISHITSUKA)
けいじゅ@いしつかです.
9 messages
2007/03/17
[#30614] Re: stdout flush in fork
— Yukihiro Matsumoto <matz@...>
2007/03/17
まつもと ゆきひろです
[#30616] Re: stdout flush in fork
— keiju@... (石塚圭樹)
2007/03/17
けいじゅ@いしつかです.
[#30620] DL.callback as free function causes errors — sheepman <sheepman@...>
こんにちは、sheepman です。
4 messages
2007/03/18
[#30627] [ ruby-Bugs-9360 ] Matrix inverse problem — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
4 messages
2007/03/19
[#30648] YARVでのalias名の取得方法 — Yukihiro Matsumoto <matz@...>
まつもと ゆきひろです
5 messages
2007/03/20
[#30653] [BUG] queue 0x424010 freed with live thread(s) waiting — Masatoshi SEKI <m_seki@...>
咳といいます。
4 messages
2007/03/20
[#30655] win32/registry wtime — moonwolf@...
MoonWolfです。
11 messages
2007/03/20
[#30658] Unicode対応と文字化け(Re: win32/registry wtime)
— Yukihiro Matsumoto <matz@...>
2007/03/21
まつもと ゆきひろです
[#30659] Re: Unicode対応と文字化け(Re: win32/registry wtime)
— Tietew <tietew+ruby-dev@...>
2007/03/21
win32/registry.rb を書いた Tietew です。
[ruby-dev:30646] Re: [ruby-core:10580] Thread後のexecでENOTSUPPエラー対応
From:
Nobuyoshi Nakada <nobu@...>
Date:
2007-03-19 17:03:56 UTC
List:
ruby-dev #30646
なかだです。
At Wed, 14 Mar 2007 21:26:31 +0900,
H.Holon wrote in [ruby-dev:30581]:
> +#ifdef _THREAD_SAFE
> + pthread_testcancel();
> +#endif
> #ifdef HAVE_NANOSLEEP
> struct timespec req, rem;
この位置だと変数宣言よりも前に実行文を追加することになるのでま
ずいです。
もう一点、この方法ではtestcancelに入るまで中断させることができ
ません。nanosleepやselectとの組合せよりも、cancel pointである
pthread_cond_timedwait()あたりを使ったほうがよくはないでしょう
か。
eval.cの分だけ。
Index: eval.c
===================================================================
--- eval.c (revision 12059)
+++ eval.c (working copy)
@@ -11737,5 +11737,9 @@ catch_timer(sig)
}
-static pthread_t time_thread;
+static struct {
+ pthread_t thid;
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+} timer;
static void*
@@ -11743,17 +11747,41 @@ thread_timer(dummy)
void *dummy;
{
- for (;;) {
-#ifdef HAVE_NANOSLEEP
- struct timespec req, rem;
+#define PER_NANO 1000000000
- req.tv_sec = 0;
- req.tv_nsec = 10000000;
- nanosleep(&req, &rem);
-#else
- struct timeval tv;
- tv.tv_sec = 0;
- tv.tv_usec = 10000;
- select(0, NULL, NULL, NULL, &tv);
-#endif
+#define cleanup_start(v, t, i, d) \
+ pthread_cleanup_push((void (*)_((void *)))pthread_##t##_##d, v);\
+ pthread_##t##_##i
+#define cleanup_end() pthread_cleanup_pop(1)
+
+ struct timespec to;
+ struct timeval tv;
+
+ /* count from the thread creation */
+ gettimeofday(&tv, NULL);
+ to.tv_sec = tv.tv_sec;
+ to.tv_nsec = tv.tv_usec * 1000;
+
+ cleanup_start(&timer.cond, cond, init, destroy)(&timer.cond, NULL);
+ cleanup_start(&timer.lock, mutex, init, destroy)(&timer.lock, NULL);
+ cleanup_start(&timer.lock, mutex, lock, unlock)(&timer.lock);
+
+ for (;;) {
+ /* 0.01sec future */
+ if ((to.tv_nsec += PER_NANO / 100) >= PER_NANO) {
+ to.tv_sec += to.tv_nsec / PER_NANO;
+ to.tv_nsec %= PER_NANO;
+ }
+ gettimeofday(&tv, NULL);
+ if ((tv.tv_sec < to.tv_sec) ||
+ (tv.tv_sec == to.tv_sec && tv.tv_usec <= to.tv_nsec * 1000)) {
+ /* has past already */
+ to.tv_sec = tv.tv_sec;
+ to.tv_nsec = tv.tv_usec * 1000;
+ continue;
+ }
+ if (!pthread_cond_timedwait(&timer.cond, &timer.lock, &to)) {
+ /* cancel request */
+ break;
+ }
if (!rb_thread_critical) {
rb_thread_pending = 1;
@@ -11763,4 +11791,8 @@ thread_timer(dummy)
}
}
+
+ cleanup_end();
+ cleanup_end();
+ cleanup_end();
}
@@ -11774,4 +11806,14 @@ rb_thread_stop_timer()
{
}
+
+void
+rb_thread_cancel_timer()
+{
+ if (!thread_init) return;
+ pthread_mutex_lock(&timer.lock);
+ pthread_cond_signal(&timer.cond);
+ pthread_mutex_unlock(&timer.lock);
+ thread_init = 0;
+}
#elif defined(HAVE_SETITIMER)
static void
@@ -11811,4 +11853,10 @@ rb_thread_stop_timer()
setitimer(ITIMER_VIRTUAL, &tval, NULL);
}
+
+void
+rb_thread_cancel_timer()
+{
+ thread_init = 0;
+}
#else /* !(_THREAD_SAFE || HAVE_SETITIMER) */
int rb_thread_tick = THREAD_TICK;
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦