in reply to Re^4: XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
in thread XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
I searched the web and came across this page where the developer tries SvOBJECT_off. Stas states, "So we get all kind of problems when automatically dereferencing it."
SvOK_off(sv); SvIVX(sv) = 0; SvOBJECT_off(sv);
It is warming to the heart (because of the frustrations at times folks hoping and/or making things threads-safe) to read, "A working solution is needed to make mp2 API perl-ithreads-safe as it's not at the moment, ...".
Stas settled with the following instead.
SV *sv = SvRV(obj); if (sv) { /* detach from the C struct and invalidate */ mg_free(sv); /* remove any magic */ SvFLAGS(sv) = 0; /* invalidate the sv */ }
I tried replacing SvOBJECT_off with mg_free in PDL 2.076.
/* Clear the sv field so that there will be no dangling ptrs */ if (it->sv) { // SvOBJECT_off((SV *)it->sv); /* problematic, issue #385 */ mg_free(it->sv); /* remove any magic instead */ sv_setiv(it->sv,0x4242); it->sv = NULL; }
etj, will that work? The Strassen demonstrations work fine and see no adverse effects during global destruction.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: XS module in ithreads Perl much slower in threads::join after adding SvOBJECT_off
by etj (Priest) on Mar 01, 2022 at 21:30 UTC | |
by marioroy (Prior) on Mar 02, 2022 at 22:14 UTC |