<div dir="ltr"><div class="gmail_default" style="font-family:courier new,monospace"><span style="font-family:arial">2014-09-17 16:09 GMT+08:00 Michael Schnell </span><span dir="ltr" style="font-family:arial"><<a href="mailto:mschnell@lumino.de" target="_blank">mschnell@lumino.de</a>></span><span style="font-family:arial">:</span></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><br>
Here you are. <br></div></blockquote><div><br></div><div class="gmail_default" style="font-family:'courier new',monospace">It is strange that it works on one computer but does not work (or partially work) on another -- causing SIGSEGV. Both running same environment - Ubuntu 14.04 x86_64 fpc 2.6.4 laz1.2.4.</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">I don't understand how the critical section works. I try to write a test program, which does the following:</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">The main thread create a predefined number of threads, which start running on creation. The thread's wait for a critical section variable, when acquired, try to crack a given integer, see if it is prime number or not, report back to main thread about the result and get the next number to crack from main thread. The main thread output crack result of every thread in a memo box.</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">I simply don't know how to coordinate the threads. And got many strange errors like</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">Semaphore init failed (maybe too many running threads)?</div><div class="gmail_default" style="font-family:'courier new',monospace">SIGABT</div><div class="gmail_default" style="font-family:'courier new',monospace">SIGTRAP</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">something wrong in raise.c, laz asked me if I want to locate myself, blahblah.</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">May I send you my source, or you can write a demo for me? Thanks a lot!</div><div class="gmail_default" style="font-family:'courier new',monospace"><br></div><div class="gmail_default" style="font-family:'courier new',monospace">Xiangrong</div></div></div></div>