Skip to content

Commit

Permalink
* eval.c (thgroup_add): no warning for terminated threads.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jul 24, 2003
1 parent 3e278b0 commit 242d187
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 26 deletions.
23 changes: 22 additions & 1 deletion ChangeLog
@@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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 changes: 1 addition & 3 deletions eval.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
25 changes: 23 additions & 2 deletions ext/socket/extconf.rb
@@ -1,7 +1,5 @@
require 'mkmf'

$CPPFLAGS += " -Dss_family=__ss_family -Dss_len=__ss_len"

case RUBY_PLATFORM
when /bccwin32/
test_func = "WSACleanup"
Expand Down Expand Up @@ -150,6 +148,29 @@
}
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)
Expand Down
12 changes: 9 additions & 3 deletions gc.c
Expand Up @@ -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;
}
}
rb_thread_critical = critical_save;
}

void
Expand Down
18 changes: 14 additions & 4 deletions lib/cgi.rb
Expand Up @@ -800,7 +800,7 @@ def read_multipart(boundary, content_length)
body = Tempfile.new("CGI")
else
begin
require "stringio" if not defined? StringIO
require "stringio"
body = StringIO.new
rescue LoadError
require "tempfile"
Expand Down Expand Up @@ -917,6 +917,7 @@ def initialize_query()
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(
Expand Down Expand Up @@ -947,7 +948,6 @@ def initialize(str, params)
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
Expand All @@ -964,8 +964,17 @@ def to_a
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)
Expand Down Expand Up @@ -1931,6 +1940,7 @@ def initialize(type = "query")
end

extend QueryExtension
@multipart = false
if "POST" != env_table['REQUEST_METHOD']
initialize_query() # set @params, @cookies
else
Expand Down
23 changes: 11 additions & 12 deletions lib/irb/locale.rb
Expand Up @@ -21,27 +21,26 @@ class Locale
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
Expand Down
6 changes: 5 additions & 1 deletion string.c
Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions variable.c
Expand Up @@ -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);
}
Expand Down

0 comments on commit 242d187

Please sign in to comment.