Issue #4474 has been updated by Shota Fukumori.


??泣?????

??域?????????????@transaction???羔?????????祉????????????????????若?吾?????????????????障??????????????с???????????
----------------------------------------
Bug #4474: 茲???違??鴻??????????????????潟?吟??激?с?潟??ャ??????????????翫?????PStore???????
http://redmine.ruby-lang.org/issues/4474

Author: Masaki Matsushita
Status: Open
Priority: Normal
Assignee: 
Category: lib
Target version: 
ruby -v: -


PStore????initialize??膃2綣????thread_safe????????с???????違????若?帥????若?鴻?茯??炊?吾?????Mutex??у?????????????????????c?????障?????
????????????罨<??潟?若??

require 'pstore'
require 'thread'

pstore = PStore.new("foo", true)
q = Queue.new

Thread.start do
  pstore.transaction do
    pstore[:hoge] = "fuga"
    q.push(nil)
    sleep
  end
end

q.pop
pstore.transaction do
  p pstore[:hoge]
end

???絎?茵???????????紊??????榊???????障?????

/usr/local/lib/ruby/1.9.1/pstore.rb:321:in `transaction': nested transaction (PStore::Error)
        from pstore.rb:16:in `<main>'

篁ヤ?????潟?若?????pstore.rb???319茵???篁????????????膕?????????????с?????

319  def transaction(read_only = false, &block)  # :yields:  pstore
320    value = nil
321    raise PStore::Error, "nested transaction" if @transaction
322    @lock.synchronize do
????????????  (筝??)
348    end
      (筝??)
352  end

Mutex??т??茘激??????????祉??激?с?潟??ャ???????????ャ??????潟?吟??激?с?潟??絎?茵?????????????????????????茯帥?鴻?????障?????
????????鴻???????????????潟?吟??激?с?潟??絎?茵?筝??ャ??鴻???????????????潟?吟??激?с?潟??ャ????????????????????????т??紊??????榊???????障?????
thread-safe????臂???箴??????障????????????????????違?с??????с???????????鐚?


-- 
http://redmine.ruby-lang.org