I tried running #2 and put a breakpoint at finish().
The threads were running fine:
When I stepped over finish, the application crashed as follows:
C:\Foo>perl -d elevator2.pl
Running...
init_elevator()...
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
Elevator::run(4)
Elevator::run(0)
Elevator::run(1)
Elevator::run(2)
Elevator::run(3)
finish()...
Attempt to free non-existent shared string 'á§B☺' during global
+destruction.
Attempt to free non-existent shared string 'InsertBreakpoint' during g
+lobal destruction.
Attempt to free non-existent shared string 'Command' during global des
+truction.
Attempt to free non-existent shared string 'WatchList' during global d
+estruction.
Attempt to free non-existent shared string 'SourceFile' during global
+destruction.
Attempt to free non-existent shared string 'Response' during global de
+struction.
Attempt to free non-existent shared string 'LineNumber' during global
+destruction.
Attempt to free non-existent shared string 'RemoveAllBreakpoints' duri
+ng global destruction.
Attempt to free non-existent shared string 'SetCurrentDirectory' durin
+g global destruction.
Free to wrong pool 436b0b0 not 15d27f8 during global destruction.
-P0w3rK!d
update (broquaint): added <readmore> tag