in reply to Testing methodology
Why would you not use Thread::Conveyor? As for testing your module, adapting Conveyor.t would at least be a place to start.
Good Day,
Dean
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Testing methodology
by BrowserUk (Patriarch) on Mar 05, 2012 at 14:36 UTC | |
Why would you not use Thread::Conveyor? Because I know better. Why are you suggesting it when you obviously do not? I was asked to update this to explain my reasoning, so here it is: Thread::Conveyor doesn't work. It isn't thread-safe. Don't believe me, try it for yourself! I'll even provide the test script for you:
Nine times out of ten this will segfault with;
On the 10th occasion it will emit the following before hanging:
And if you trace the run you get: <Reveal this spoiler or all in this thread>
| [reply] [d/l] [select] |
by duelafn (Parson) on Mar 05, 2012 at 17:33 UTC | |
Thank you very much for updating and giving your reason. I do in fact use Thread::Conveyor and had never run in to the segfault issue. Upon investigation, I only get the segfault when I set the stack size globally (when I load the threads module or via threads->set_stack_size(). I have no problems if I set the stack size at thread creation time (below). This explains why I have never run into trouble. Clearly, there is some problem with Thread::Conveyor and you have convinced me that there might be some reason to avoid it. Determining whether the problem is fixable is probably beyond me.
Good Day, | [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Mar 06, 2012 at 02:59 UTC | |
FWIW: Here, the crash seems to be unrelated to the stack_size parameter, regardless of where it is applied. It seems to be entirely due to global clean up. That said, even if I defer global clean up, it still has severe problems. Here's my test code and some typical results (Terminated on sigint means it hung):
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.
| [reply] [d/l] |