Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Gtk2 ....needs thread testing on a multi-threaded computer

by kikuchiyo (Monk)
on Dec 15, 2009 at 23:31 UTC ( #812951=note: print w/ replies, xml ) Need Help??


in reply to Gtk2 ....needs thread testing on a multi-threaded computer

I've got this on the first run:

panic: attempt to copy freed scalar 296b060 to 1511250 at gtkthreadtes +t.pl line 188. Segmentation fault

I didn't see anything abnormal since that.

By the way, is this what they call a race condition?


Comment on Re: Gtk2 ....needs thread testing on a multi-threaded computer
Download Code
Re^2: Gtk2 ....needs thread testing on a multi-threaded computer
by zentara (Archbishop) on Dec 16, 2009 at 14:34 UTC
    By the way, is this what they call a race condition

    .....oooh i think i see the problem..... i thought $finish was the only var where locking was needed, but the main thread also resets $track{$tr}{'tot'} ...... each thread writes to it's own, but main resets them to zero

    ....on a single cpu machine it appears to work, probably because of its linear timing

    ....thanks for the report...i will have to think about how to handle locking $track{$tr}{'tot'}

    if you could give a quick try at line 188

    lock $track{$tr}{'tot'}; $track{$tr}{'tot'} += (rand 5) + $whip;

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
      I tried the fixed version - no segfaults this time, nor any other sign of incorrect behavior.
        ... hi, i just updated the script to lock all shared variables.... now the question is... are they locked properly for a multicpu motherboard?..... walmart had a multicore toshiba laptop for 399 awhile ago..... i should have grabbed one..... but they seem to get cheaper every year..... so no sweat :-) ..... thanks for testing it

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://812951]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2014-10-24 16:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (133 votes), past polls