Author: Dann Corbit
Date: 14:31:46 11/07/02
Go up one level in this thread
On November 07, 2002 at 17:10:12, Russell Reagan wrote: >I would like to add multi-threading into my engine, to make it interface more >easily with winboard, and eventually play around with supporting SMP. I have a >few questions about multi-threading issues however. > >I would like to be portable, but that seems rather difficult. I asked about >pthreads, and someone said they aren't really that portable, and recommended >using SDL (www.libsdl.org). What is the best bet if I eventually want to support >linux/unix in addition to windows? > >Secondly, I like the Interlocked functions on Windows. Is there anything similar >on Linux or Unix? > >Lastly, is there any way to write your own routines to make your threads work >correctly? Or is it something that has to be implemented at the OS level? What's >wrong with passing messages between threads using simple atomic operations? For >example, if I have an input thread, and I want to signal my search thread that >it should stop, why can't I set a global variable that the search thread reads >from? It seems like it would work if you did message passing using one way >variables (like thread1 only writes to var1 and thread2 only reads var1, thread2 >only writes to var2, thread1 reads var2, etc.). In Crafty there looks like some >code that isn't OS specific, but I don't see how it avoids synchronization >problems. > >Multi-threading makes me feel quite insecure that my program is running >bug-free. It seems like you have to be an expert on the subject before you can >even begin to spot potential bugs. I guess it's best to stick to as few shared >variables as possible? If you use C++, take a look at ACE http://www.cs.wustl.edu/~schmidt/ACE.html and you will be portable to a bazillion platforms all at once.
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.