1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (thgroup_add): no warning for terminated threads.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-07-24 05:18:47 +00:00
parent 169300a4f8
commit e02b469de1
8 changed files with 88 additions and 26 deletions

View file

@ -1,3 +1,7 @@
Thu Jul 24 13:32:56 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (thgroup_add): no warning for terminated threads.
Thu Jul 24 13:09:26 2003 Tanaka Akira <akr@m17n.org>
* lib/pathname.rb: added.
@ -39,6 +43,14 @@ Thu Jul 24 03:41:30 2003 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/tcltklib/tcltklib.c (ip_init): need at least one statement after
label.
Thu Jul 24 01:48:03 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/cgi.rb (CGI::QueryExtension::[]): should return StringIO (or
Tempfile) for multipart/form.
* variable.c (rb_define_const): give warning for non constant
name. [ruby-core:01287]
Thu Jul 24 01:51:08 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
* lib/webrick: imported.
@ -58,6 +70,10 @@ Wed Jul 23 23:06:59 2003 WATANABE Hirofumi <eban@ruby-lang.org>
* file.c (DOSISH): better Cygwin support.
Wed Jul 23 19:13:21 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_split_m): the receiver may be empty string.
Wed Jul 23 18:43:00 2003 Masatoshi SEKI <m_seki@mva.biglobe.ne.jp>
* lib/erb.rb: import erb-2.0.4b1.
@ -23203,5 +23219,10 @@ Wed Aug 13 17:51:46 1997 Yukihiro Matsumoto <matz@netlab.co.jp>
* version 1.1 alpha0 released.
Local variables:
add-log-time-format: current-time-string
add-log-time-format: (lambda ()
(let* ((time (current-time))
(diff (+ (cadr time) 32400))
(lo (% diff 65536))
(hi (+ (car time) (/ diff 65536))))
(format-time-string "%c" (list hi lo) t)))
end:

4
eval.c
View file

@ -9024,7 +9024,6 @@ rb_thread_kill(thread)
if (th == th->next || th == main_thread) rb_exit(0);
rb_thread_ready(th);
th->thgroup = 0;
th->status = THREAD_TO_KILL;
if (!rb_thread_critical) rb_thread_schedule();
return thread;
@ -9965,8 +9964,7 @@ thgroup_add(group, thread)
}
if (!th->thgroup) {
rb_warn("terminated thread");
return group;
return Qnil;
}
if (OBJ_FROZEN(th->thgroup)) {
rb_raise(rb_eThreadError, "can't move from the frozen thread group");

View file

@ -1,7 +1,5 @@
require 'mkmf'
$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
case RUBY_PLATFORM
when /bccwin32/
test_func = "WSACleanup"
@ -150,6 +148,29 @@ main()
}
EOF
$CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
else # doug's fix, NOW add -Dss_family... only if required!
$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"
if try_link(<<EOF)
#ifdef _WIN32
# include <windows.h>
# include <winsock.h>
#else
# include <sys/types.h>
# include <netdb.h>
# include <string.h>
# include <sys/socket.h>
#endif
int
main()
{
struct sockaddr_storage ss;
ss.ss_family;
return 0;
}
EOF
$CFLAGS="-DHAVE_SOCKADDR_STORAGE "+$CFLAGS
end
end
if try_link(<<EOF)

14
gc.c
View file

@ -1536,20 +1536,26 @@ run_final(obj)
int status, critical_save;
VALUE args[2], table;
critical_save = rb_thread_critical;
rb_thread_critical = Qtrue;
args[1] = rb_ary_new3(1, rb_obj_id(obj)); /* make obj into id */
for (i=0; i<RARRAY(finalizers)->len; i++) {
args[0] = RARRAY(finalizers)->ptr[i];
critical_save = rb_thread_critical;
rb_thread_critical = Qtrue;
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
rb_thread_critical = critical_save;
CHECK_INTS;
}
CHECK_INTS;
if (finalizer_table && st_delete(finalizer_table, &obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
args[0] = RARRAY(table)->ptr[i];
critical_save = rb_thread_critical;
rb_thread_critical = Qtrue;
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
}
}
rb_thread_critical = critical_save;
CHECK_INTS;
}
}
}
void

View file

@ -800,7 +800,7 @@ convert string charset, and set language to "ja".
body = Tempfile.new("CGI")
else
begin
require "stringio" if not defined? StringIO
require "stringio"
body = StringIO.new
rescue LoadError
require "tempfile"
@ -917,6 +917,7 @@ convert string charset, and set language to "ja".
if ("POST" == env_table['REQUEST_METHOD']) and
%r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(env_table['CONTENT_TYPE'])
boundary = $1.dup
@multipart = true
@params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
else
@params = CGI::parse(
@ -947,7 +948,6 @@ convert string charset, and set language to "ja".
super(str)
end
def [](idx)
p caller(1)
warn "#{caller(1)[0]}:CAUTION! cgi['key'] == cgi.params['key'][0]; if want Array, use cgi.params['key']"
self
end
@ -964,8 +964,17 @@ convert string charset, and set language to "ja".
def [](key)
params = @params[key]
value = params[0]
value ||= ""
Value.new(value,params)
if @multipart
if value
return value
elsif defined? StringIO
StringIO.new("")
else
Tempfile.new("CGI")
end
else
Value.new(value || "", params)
end
end
def keys(*args)
@ -1931,6 +1940,7 @@ The hash keys are case sensitive. Ask the samples.
end
extend QueryExtension
@multipart = false
if "POST" != env_table['REQUEST_METHOD']
initialize_query() # set @params, @cookies
else

View file

@ -21,27 +21,26 @@ module IRB
LOCALE_DIR = "/lc/"
def initialize(locale = nil)
@lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"]
@lang = "C" unless @lang
@lang = locale || ENV["IRB_LANG"] || ENV["LC_MESSAGES"] || ENV["LC_ALL"] || ENV["LANG"] || "C"
end
attr_reader :lang
@@LC2KCONV = {
# "ja" => Kconv::JIS,
# "ja_JP" => Kconv::JIS,
"ja_JP.ujis" => Kconv::EUC,
"ja_JP.euc" => Kconv::EUC,
"ja_JP.eucJP" => Kconv::EUC,
"ja_JP.sjis" => Kconv::SJIS,
"ja_JP.SJIS" => Kconv::SJIS,
}
def lc2kconv(lang)
case lang
when "ja_JP.ujis", "ja_JP.euc", "ja_JP.eucJP"
Kconv::EUC
when "ja_JP.sjis", "ja_JP.SJIS"
Kconv::SJIS
end
end
private :lc2kconv
def String(mes)
mes = super(mes)
case @lang
when /^ja/
mes = Kconv::kconv(mes, @@LC2KCONV[@lang])
mes = Kconv::kconv(mes, lc2kconv(@lang))
else
mes
end

View file

@ -2557,7 +2557,11 @@ rb_str_split_m(argc, argv, str)
if (rb_scan_args(argc, argv, "02", &spat, &limit) == 2) {
lim = NUM2INT(limit);
if (lim <= 0) limit = Qnil;
else if (lim == 1) return rb_ary_new3(1, str);
else if (lim == 1) {
if (RSTRING(str)->len == 0)
return rb_ary_new2(0);
return rb_ary_new3(1, str);
}
i = 1;
}

View file

@ -1548,6 +1548,9 @@ rb_define_const(klass, name, val)
{
ID id = rb_intern(name);
if (!rb_is_const_id(id)) {
rb_warn("rb_define_const: invalide name `%s' for constant", name);
}
if (klass == rb_cObject) {
rb_secure(4);
}