Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How to make thread-save data on C API

by BrowserUk (Pope)
on Sep 20, 2013 at 12:14 UTC ( #1055009=note: print w/replies, xml ) Need Help??


in reply to How to make thread-save data on C API

See SvSHARE(), SvLOCK & SvUNLOCK in perlapi.

Alternatively, you might do:

use threads; use threads::shared; my $d : shared; $d = shared_clone( mymodule::myfunc() );

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: How to make thread-save data on C API
by Tormalon (Initiate) on Sep 20, 2013 at 14:04 UTC
    Thanks for the info. Unfortunately, the SvSHARE does not work for me - I always receive empty HASHREF:
    rt = newHV(); SvSHARE((SV*)rt); sv = newSViv(42); //SvSHARE(sv); hv_stores(rt, "fe", sv); ... ST(i) = sv_2mortal((SV*)newRV_noinc((SV*)rt)); XSRETURN(4); --- result for this tuple: $VAR1 = {};
    So, I have shared HASH, but without any contents inside hash... I'll use shared_clone, but I think I can reproduce/clone the shared_clone source code...
      So, I have shared HASH, but without any contents inside hash

      No. I can't make it work either :(


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1055009]
help
Chatterbox?
[Corion]: 1nickt: That one sounds sensible as it will tell you when it found an error
[1nickt]: Throws on error, I believe
[1nickt]: But should handle month as number or word
[TCLion]: I am breaking down the line and putting the date in the correct order during output
[TCLion]: at least that's the plan
[1nickt]: Corion this looks good, from the pod: "there are 9000+ variations that are detected correctly in the test files (see t/data/* for most of them). If you can think of any that I do not cover, please let me know."
[TCLion]: some moron put the date like this : Mon Feb 20 09:31:30 2017
[Corion]: 1nickt: Yes, the module sounds promising indeed
[1nickt]: "putting the date in correct order" how?

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (17)
As of 2017-03-23 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (288 votes). Check out past polls.