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�
+5533;�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
| [reply] [d/l] |
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.
| [reply] [d/l] |
| [reply] |