Re: [問題] 關於Thread
呃呃呃,用 utf-8 的 ptt 發文結果當掉 orz
重打
※ 引述《wwwc (郭大維老師大好人)》之銘言:
: 其實我要做的事情比較像這樣
: server = TCPServer.new(ip, port)
: a = 0
: t = Thread.new{
: #計算accept的次數
: while server.accept
: a += 1
case a
when 50: 通知某人
when 60: 通知某人
end
: end
: }
這樣會不會好些?
千萬不要放空 loop, 太吃資源了
至於 p 那個,我還要再去看 ruby src,
這樣猜我想不到會是什麼問題
--
In Lisp, you don't just write your program down toward the language,
you also build the language up toward your program.
《Programming Bottom-Up》- Paul Graham 1993
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.117.166.175
推
11/01 17:54, , 1F
11/01 17:54, 1F
討論串 (同標題文章)
Ruby 近期熱門文章
PTT數位生活區 即時熱門文章