mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* rubysig.h (CHECK_INTS): prevent signal handler to run during
critical section. [ruby-core:04039] * eval.c (load_wait): need not to call rb_thread_schedule() explicitly. [ruby-core:04039] * eval.c (rb_thread_schedule): clear rb_thread_critical. [ruby-core:04039] * st.c (st_free_table): do not call free() but xfree(). [ruby-core:06205] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9417 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d53ad837dd
commit
222ee5ee46
4 changed files with 41 additions and 31 deletions
16
ChangeLog
16
ChangeLog
|
@ -37,6 +37,17 @@ Sun Oct 16 14:30:05 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
|||
|
||||
* test/rinda/test_rinda.rb: test it.
|
||||
|
||||
Sun Oct 16 03:38:07 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* rubysig.h (CHECK_INTS): prevent signal handler to run during
|
||||
critical section. [ruby-core:04039]
|
||||
|
||||
* eval.c (load_wait): need not to call rb_thread_schedule()
|
||||
explicitly. [ruby-core:04039]
|
||||
|
||||
* eval.c (rb_thread_schedule): clear rb_thread_critical.
|
||||
[ruby-core:04039]
|
||||
|
||||
Sat Oct 15 19:56:38 2005 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
|
||||
|
||||
* bin/erb: typo fixed, again. thanks, Doug Kearns.
|
||||
|
@ -75,6 +86,11 @@ Tue Oct 11 21:41:58 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
|||
|
||||
* eval.c (rb_respond_to): conform to Object#respond_to?. [ruby-dev:27411]
|
||||
|
||||
Tue Oct 11 00:01:21 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* st.c (st_free_table): do not call free() but xfree().
|
||||
[ruby-core:06205]
|
||||
|
||||
Sat Oct 8 20:04:40 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (Init_Binding): add Binding#dup method. [yarv-dev:666]
|
||||
|
|
13
eval.c
13
eval.c
|
@ -6864,19 +6864,19 @@ rb_provide(feature)
|
|||
rb_provide_feature(rb_str_new2(feature));
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
load_wait(ftptr)
|
||||
char *ftptr;
|
||||
{
|
||||
st_data_t th;
|
||||
|
||||
if (!loading_tbl) return;
|
||||
if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return;
|
||||
if ((rb_thread_t)th == curr_thread) return;
|
||||
if (!loading_tbl) return Qfalse;
|
||||
if (!st_lookup(loading_tbl, (st_data_t)ftptr, &th)) return Qfalse;
|
||||
do {
|
||||
if ((rb_thread_t)th == curr_thread) return Qtrue;
|
||||
CHECK_INTS;
|
||||
rb_thread_schedule();
|
||||
} while (st_lookup(loading_tbl, (st_data_t)ftptr, &th));
|
||||
return Qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -7007,8 +7007,7 @@ rb_require_safe(fname, safe)
|
|||
ruby_safe_level = safe;
|
||||
found = search_required(fname, &feature, &path);
|
||||
if (found) {
|
||||
if (!path) {
|
||||
load_wait(RSTRING(feature)->ptr);
|
||||
if (!path || load_wait(RSTRING(path)->ptr)) {
|
||||
result = Qfalse;
|
||||
}
|
||||
else {
|
||||
|
|
17
rubysig.h
17
rubysig.h
|
@ -82,10 +82,9 @@ void rb_thread_schedule _((void));
|
|||
#if defined(HAVE_SETITIMER) || defined(_THREAD_SAFE)
|
||||
RUBY_EXTERN int rb_thread_pending;
|
||||
# define CHECK_INTS do {\
|
||||
if (!rb_prohibit_interrupt) {\
|
||||
if (!(rb_prohibit_interrupt | rb_thread_critical)) {\
|
||||
if (rb_thread_pending) rb_thread_schedule();\
|
||||
if (rb_trap_pending) rb_trap_exec();\
|
||||
if (rb_thread_pending && !rb_thread_critical)\
|
||||
rb_thread_schedule();\
|
||||
}\
|
||||
} while (0)
|
||||
#else
|
||||
|
@ -93,15 +92,13 @@ RUBY_EXTERN int rb_thread_pending;
|
|||
RUBY_EXTERN int rb_thread_tick;
|
||||
#define THREAD_TICK 500
|
||||
#define CHECK_INTS do {\
|
||||
if (!rb_prohibit_interrupt) {\
|
||||
if (rb_trap_pending) rb_trap_exec();\
|
||||
if (!rb_thread_critical) {\
|
||||
if (rb_thread_tick-- <= 0) {\
|
||||
rb_thread_tick = THREAD_TICK;\
|
||||
rb_thread_schedule();\
|
||||
}\
|
||||
if (!(rb_prohibit_interrupt | rb_thread_critical)) {\
|
||||
if (rb_thread_tick-- <= 0) {\
|
||||
rb_thread_tick = THREAD_TICK;
|
||||
rb_thread_schedule();
|
||||
}\
|
||||
}\
|
||||
if (rb_trap_pending) rb_trap_exec();\
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
|
26
st.c
26
st.c
|
@ -5,14 +5,12 @@
|
|||
#include "config.h"
|
||||
#include "defines.h"
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STDLIB_H
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "st.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
typedef struct st_table_entry st_table_entry;
|
||||
|
||||
struct st_table_entry {
|
||||
|
@ -218,12 +216,12 @@ st_free_table(table)
|
|||
ptr = table->bins[i];
|
||||
while (ptr != 0) {
|
||||
next = ptr->next;
|
||||
free(ptr);
|
||||
xfree(ptr);
|
||||
ptr = next;
|
||||
}
|
||||
}
|
||||
free(table->bins);
|
||||
free(table);
|
||||
xfree(table->bins);
|
||||
xfree(table);
|
||||
}
|
||||
|
||||
#define PTR_NOT_EQUAL(table, ptr, hash_val, key) \
|
||||
|
@ -342,7 +340,7 @@ rehash(table)
|
|||
ptr = next;
|
||||
}
|
||||
}
|
||||
free(table->bins);
|
||||
xfree(table->bins);
|
||||
table->num_bins = new_num_bins;
|
||||
table->bins = new_bins;
|
||||
}
|
||||
|
@ -365,7 +363,7 @@ st_copy(old_table)
|
|||
Calloc((unsigned)num_bins, sizeof(st_table_entry*));
|
||||
|
||||
if (new_table->bins == 0) {
|
||||
free(new_table);
|
||||
xfree(new_table);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -375,8 +373,8 @@ st_copy(old_table)
|
|||
while (ptr != 0) {
|
||||
entry = alloc(st_table_entry);
|
||||
if (entry == 0) {
|
||||
free(new_table->bins);
|
||||
free(new_table);
|
||||
xfree(new_table->bins);
|
||||
xfree(new_table);
|
||||
return 0;
|
||||
}
|
||||
*entry = *ptr;
|
||||
|
@ -411,7 +409,7 @@ st_delete(table, key, value)
|
|||
table->num_entries--;
|
||||
if (value != 0) *value = ptr->record;
|
||||
*key = ptr->key;
|
||||
free(ptr);
|
||||
xfree(ptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -422,7 +420,7 @@ st_delete(table, key, value)
|
|||
table->num_entries--;
|
||||
if (value != 0) *value = tmp->record;
|
||||
*key = tmp->key;
|
||||
free(tmp);
|
||||
xfree(tmp);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -522,7 +520,7 @@ st_foreach(table, func, arg)
|
|||
last->next = ptr->next;
|
||||
}
|
||||
ptr = ptr->next;
|
||||
free(tmp);
|
||||
xfree(tmp);
|
||||
table->num_entries--;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue