Subject: | cleaning up Win32::IPC |
I am refactoring the XS code in IPC to bring it into the 21st century in speed/optimization/machine code size.
My first issue is, when I changed BOOL in the typemap from T_IV to T_TRUEFALSE. Test started to fail.
-----------------------------------------------
t\30-Mutex.t ......... # This test should take no more than 10 seconds.
# If it takes longer, please kill it with Ctrl-Break (Ctrl-C won't work right).
t\30-Mutex.t ......... 1/15
# Failed test 'release 4 fails'
# at t\30-Mutex.t line 37.
# got: ''
# expected: '0'
# Failed test 'release unowned mutex 2 fails'
# at t\30-Mutex.t line 45.
# got: ''
# expected: '0'
# Looks like you failed 2 tests of 15.
-----------------------------------------
It is because of is() being used like "is($m->release, 0, 'release unowned mutex 2 fails');" is() does a "eq" not "==". Immortal PL_sv_no is empty string PV, and 0 IV, not "0" PV and 0 IV, but eq will use the PV first if available obviously.
The docs say
-----------------------------------------
=item $mutex->release
Release ownership of a C<$mutex>. You should have obtained ownership
of the mutex through C<new> or one of the wait functions. Returns
true if successful, or zero if it fails (additional error
information can be found in C<$^E>).
-----------------------------------------
Not returning 0 or "0" or "". What is you take? does it have to return "0" on failure or is "" fine? Both test identically in a if() so I think the impact to code should be none.
I have a solution to make a fast return SVIV 0 but it will complicate the module vs using boolSV/&PL_sv_no so I'd rather not use.