in reply to Re: Why won't this Deadlock?
in thread Why won't this Deadlock?
I'm going on vacation soon, so I'll print on the manuals to MCE::* and try to comment on how this research compares.
It seems you are way ahead of me in thinking about this. That's a cool venture (MCE::*); I see tonnes of applications for it.DESCRIPTION A Hobo is a migratory worker inside the machine that carries the asynchronous gene. Hobos are equipped with "threads"-like capability for running code asynchronously. Unlike threads, each hobo is a unique process to the underlying OS. The IPC is managed by "MCE::Shared", which runs on all the major platforms including Cygwin.
I appreciate the diff. Thank-you.
Do you have terminology for the scope of data shared between processes?
So PIE in the sky question is...
How would I have a data shared for the lifetime of a block, and I want that block to run first, amongst all the processes that share it?
My Brain is saying that setting a mutex to protect the call to $val would be a recursive solution with no end? Eg. No atomic-ity, eg deadlock. Yeah, if it was synchronous it would work, but it's not.{ use MCE::Shared; my $cnt; #tie my $cnt, 'MCE::Shared', { module => 'MCE::Shared::Scalar' }, 0; tie my $va1, 'MCE::Shared', { module => 'MCE::Shared::Scalar' }, sub { + return $cnt++; }; #just for fun let's make a closure # How can I be sure that ($val->() == 0)? say ($val->()) ? 0 : 1; # says 1 if first caller }
I said deadlock is on the horizon because the block could be wrapped in another block with a different mutex controlling the lower one. Got to run to an appointment. I'm going to be late. All the best, Jambo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Why won't this Deadlock?
by marioroy (Prior) on Jul 11, 2017 at 16:33 UTC |