Fork and modifying variables inside the new process

irb(main):001:0> a = true
=> true
irb(main):002:0> fork do
irb(main):003:1* a = false
irb(main):004:1> end
=> 2525
irb(main):005:0> a
=> true

Why is this so? What is the point of having my mutexes if I can’t
manipulate the data anyway?

-Kurt

Kurt M. Dresner wrote:

irb(main):001:0> a = true
=> true
irb(main):002:0> fork do
irb(main):003:1* a = false
irb(main):004:1> end
=> 2525
irb(main):005:0> a
=> true

Why is this so? What is the point of having my mutexes if I can’t
manipulate the data anyway?

-Kurt

Fork creates a whole new heavy process. I think you are looking for
Thread. Try something like:

Thread.new {
a = false
}

The problem is that I want to call exec inside the new process, as well
as being able to send it things like SIGSTOP and SIGCONT.

Is there a way I can do this?

-Kurt

···

On Sun, Aug 17, 2003 at 07:57:51AM +0900, mgarriss wrote:

Kurt M. Dresner wrote:

irb(main):001:0> a = true
=> true
irb(main):002:0> fork do
irb(main):003:1* a = false
irb(main):004:1> end
=> 2525
irb(main):005:0> a
=> true

Why is this so? What is the point of having my mutexes if I can’t
manipulate the data anyway?

-Kurt

Fork creates a whole new heavy process. I think you are looking for
Thread. Try something like:

Thread.new {
a = false
}

======= End of Original Message =======<

Actually it turns out I don’t need that, I’m ok.

sorry,

Kurt

···

On Sun, Aug 17, 2003 at 08:09:20AM +0900, Kurt M. Dresner wrote:

The problem is that I want to call exec inside the new process, as well
as being able to send it things like SIGSTOP and SIGCONT.

Is there a way I can do this?

-Kurt

On Sun, Aug 17, 2003 at 07:57:51AM +0900, mgarriss wrote:

Kurt M. Dresner wrote:

irb(main):001:0> a = true
=> true
irb(main):002:0> fork do
irb(main):003:1* a = false
irb(main):004:1> end
=> 2525
irb(main):005:0> a
=> true

Why is this so? What is the point of having my mutexes if I can’t
manipulate the data anyway?

-Kurt

Fork creates a whole new heavy process. I think you are looking for
Thread. Try something like:

Thread.new {
a = false
}

======= End of Original Message =======<

======= End of Original Message =======<