in reply to multithreaded debugging
Sounds to me like you need to post a complete program that demonstrates the error, otherwise we're either guessing or trying to write a wrapper around your subs which may or may not be similar to what you're actually doing.
Also, while you're crafting a minimal test case, put in lots more print statements and don't forget to "use strict" and "use warnings".
non-Perl: Andy Ford
In Section
Seekers of Perl Wisdom