From: ahoward Date: 2002-12-10T08:23:04+09:00 Subject: Re: Ruby BUG when using PStore and fork On Tue, 10 Dec 2002, Yukihiro Matsumoto wrote: > > In message "Ruby BUG when using PStore and fork" > on 02/12/10, Jeremy Henty writes: > > |PStore does not appear to play well with fork. This script > | > |#!/usr/bin/env ruby > | > |require 'pstore' > |store = PStore.new("/tmp/pstore") > |store.transaction do > | fork do > | store.abort > | end > | Process.wait > | exit > |end > | > | ... results in: > | > |../pstore_fork_bug.rb:7: [BUG] Unknown longjmp status 7 > |ruby 1.6.7 (2002-03-01) [i586-linux] > > Ah, you can't. "fork" creates copy of the process. Copied child > process cannot affect the parent process. How can we abort > transaction from the child process. > > Current pstore does not work well with threads either. i have gotten around this problem by spawning another process using the unix at command with a time of 'now' in otherwords, instead of forking spawn a process which does the same thing to the pstore *now*. pstores do work transactionally between processes. additionally, you may want to copy the 'being updated' pstore to a temnam'd file so any update transaction will not block the original process. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ==================================== SIGSIG -- signature too long (core dumped)