新規記事投稿
フォロー記事投稿
記事のキャンセル
From: にあ
<nir@mvg.biglobe.ne.jp>
Subject: Re: サブルーチンが動かない?
Date: 2000/06/03 12:44:21
Reference: mesh.forum.4/00214
6月3日に、いしどうさんは書きました。
>最新版(5.6.0)をソースからコンパイルしたのがいま使ってるPC(Windows2000)
>に入ってるんですけど、うぇぶ会議室は動作しましたよ。
ふーむ。
>C:\>perl -V
>Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
> Platform:
> osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
> usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define
>C:\>perl -v
>This is perl, v5.6.0 built for MSWin32-x86-multi-thread
ほほう、一口にスレッドと言っても問題ない物とそうでない物とがあるのですね。
試しに手元のsolaris7マシンでスレッド対応とそうじゃ無い物の2つのperl5.6.0を
コンパイルし以下のスクリプトを実行して見ました。
----- ここから -----
#!/usr/local/bin/perl
require Config;
import Config;
foreach (keys %Config) {
next unless (/thread|osname|osvers|archname/ && defined($Config{$_}));
printf("%s = %s\n", $_, $Config{$_});
}
sub child {
local(*_) = @_;
print "child: $_\n";
$_ = 'child($_)';
}
sub parent {
local($str) = 'parent($str)';
local($_) = 'parent($_)';
child(*str);
print "parent: $_\n";
}
print "-----\n";
parent();
----- ここまで -----
----- 結果(スレッド無し) ----
archname = sun4-solaris
osname = solaris
osvers = 2.7
archname64 =
i_pthread = define
myarchname = sun4-solaris
old_pthread_create_joinable =
-----
child: parent($str)
parent: parent($_)
----- ここまで -----
----- 結果(スレッド有り) ----
archname = sun4-solaris-thread
osname = solaris
osvers = 2.7
archname64 =
i_pthread = define
myarchname = sun4-solaris
old_pthread_create_joinable =
use5005threads = define
usethreads = define
-----
child: parent($_)
parent: child($_)
----- ここまで -----
どうも、いしどうさんの結果と合わせてみると、interpreter-based threadsでは
問題は出ないけど、5.005 version threadsを使っている物では上手く動かない、
と言うことでしょうか?
# いしどうさんの結果で 'usethreads=undef' になっているのがチョット気になりますが。