Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Horse Race for linux!

by i5513 (Monk)
on Apr 02, 2012 at 13:43 UTC ( #963010=note: print w/ replies, xml ) Need Help??


in reply to Re: Horse Race for linux!
in thread Horse Race for linux!

Greatful, thanks a lot, I will take a look to the code ! I get a seg fault, while horses are running, some races works fine some others not.

$ LANG=C perl horses_gtk *** glibc detected *** perl: realloc(): invalid pointer: 0x&#65533;&#6 +5533;&#65533;3 *** *** unhandled exception in callback: *** `<span foreground="bl...' is not of type Gtk2::Widget at horses_ +gtk line 209. *** ignoring at horses_gtk line 228. Abortado (`core' generado) $ LANG=C perl horses_gtk Violación de segmento (`core' generado) $ file core core: ELF 64-bit LSB core file x86-64, version 1 (SYSV), SVR4-style, f +rom 'perl horses_gtk' $ ls -lh core -rw------- 1 user group 80M abr 2 15:36 core


Comment on Re^2: Horse Race for linux!
Download Code
Re^3: Horse Race for linux!
by zentara (Archbishop) on Apr 02, 2012 at 14:21 UTC
    Thanks for the report. Its been a while since I tested it. I just ran it a few times myself, and am getting similar failures. I'll work at it and report any fixes I can find.

    Update: I believe it is a locking problem, as I try to lock a hash acting as a container variable, as in lock $track{$tr}{'go'};

    I was counting on each track to have it's own shared variable, so I thought locking would not be a problem. It didn't seem to matter on a single cpu computer, but now I have a multi-core computer, and it matters. Furthermore, I thought I could lock a portion of the shared hash container %track, but I read in perldoc threads::shared that it causes errors.

    From perldoc threads::shared: You cannot lock the individual elements of a container variable: my %hash :shared; $hash{'foo'} = 'bar'; #lock($hash{'foo'}); # Error lock(%hash); # Works If you need more fine-grained control over shared variable +access, see Thread::Semaphore.
    So it seems this code needs a re-write to make locking work.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
Re^3: Horse Race for linux!
by zentara (Archbishop) on Apr 03, 2012 at 18:30 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2015-07-02 09:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (33 votes), past polls