On Fri, 8 Aug 2008 23:41:17 +0100 Ben Morrow <[EMAIL PROTECTED]> wrote:
BM> Just use the interpreter address: it's more unique than either pid or
BM> tid, and actually reflects 'Perl-level thread of control'. I would say
BM> that a second function in D::C (what, two whole functions in one module?
BM> Shocking!) to return the interpreter address would be the way to go.
Is this a decent implementation?
IV
context()
CODE:
RETVAL = PTR2UV(Perl_get_context());
OUTPUT:
RETVAL
It seems *too* simple so I must be forgetting something.
I get paid by the number of CPAN modules released, so yes, this will be
Devel::GetContext, one function per module :)
BM> If you want calls to every(5) to only return true once every five times
BM> even across forked processes, your going to need some sort of IPC,
BM> obviously.
It's actually not hard to do, just tie the hash to a shared memory
segment with Tie::ShareLite and ignore the $$ and context() uniqueness.
But I really doubt Every.pm should provide it, it's a solution in search
of a problem.
Ted