Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: Win32, fork and XS globals

by syphilis (Canon)
on Oct 02, 2011 at 08:15 UTC ( #929119=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Win32, fork and XS globals
in thread Win32, fork and XS globals

Be buggered ... this actually seems to work:

use warnings; use Inline C => Config => NAME => 'expt', BOOT => " { MY_CXT_INIT; MY_CXT.count = 5; } ", BUILD_NOISY => 1, ; use Inline C => <<'EOC'; #define MY_CXT_KEY "expt::_guts" XS_VERSION typedef struct { int count; } my_cxt_t; START_MY_CXT void set_x(int z) { dMY_CXT; MY_CXT.count = z; } void get_x(char * id) { dMY_CXT; printf("%s %d\n", id, MY_CXT.count); } void CLONE(SV * x, ...) { MY_CXT_CLONE; } EOC get_x('1st call:'); if($pid = fork()) { waitpid($pid,0); } else { set_x(10); get_x('2nd call:'); exit(0); } get_x('3rd call:');
It outputs:
1st call: 5 2nd call: 10 3rd call: 5
Must investigate further.

Cheers,
Rob


Comment on Re^3: Win32, fork and XS globals
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://929119]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2015-07-05 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls