fork and modifying variables inside the new process

K

Kurt M. Dresner

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
 
M

mgarriss

Kurt said:
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
}
 
K

Kurt M. Dresner

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top