WATANABE Hirofum wrote: > わたなべです. > > Mamoru Matushita <mamoru / po.kannet.or.jp> writes: > > :ところでflock関数(?)を試してみたところ > :「The flock() function is unimplemented on this machine.」 > :と怒られてしまいました。これはPerlの時と同じく、Windows > :環境では使えないって事なのでしょうか? > > 使えません. 他にも unimplemented と表示されるものは使えません. > > symlink なんですが, cygwin32 版は単なるエミュレーションなの > で, 排他制御に使うことはできません. > atomic に test & set できるとしたら mkdir ぐらいかな. symlinkでも動いているように見えたんですが気のせいだったようですね。 とりあえずmkdirを使ってロックファイルを実現してみました。 どうもありがとうございました。 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ $data="./test.dat"; $lock="./lock"; #new begin check_file=open($data,"r") rescue new_file=open($data,"w") new_file.print "0\n" new_file.close end #lock try=0 begin Dir.mkdir($lock) rescue try+=1 if try>5 then print"error\n" Dir.rmdir($lock) exit 0 else sleep(2) retry end end count=open($data,"r") c=count.gets.to_i c+=1 count.close count=open($data,"w") count.print c count.close count=open($data,"r") c=count.gets count.close #html print"Content-type:text/html\n\n"; print"<html><head><title>count test</title></head>\n"; print"<body>\n"; print c; print"</body></html>\n"; Dir.rmdir($lock) exit 0 ----------------------------------------------------------- ホームページ随時更新中!! 遊びに来てね。 I like it!(http://www.kannet.or.jp/matusita/index.htm) Java Java Java(http://www.kannet.or.jp/matusita/jindex.htm)