Computer Chess Club Archives


Search

Terms

Messages

Subject: pthreads with g++ (Unix experts please help)

Author: James Swafford

Date: 16:55:21 11/15/99


I'm working on creating a Linux port of my engine.

A few months ago I posted a question concerning the
unix equivalent of MSVC's "beginthread( )."
After some discussion, it was determined that
pthread_create() was what I was looking for.

At the time I was using a cygnus port of gcc,
which doesn't support pthreads.  Consequently,
I put the whole thing on a shelf for a couple of
months while I worked on my GUI. :-)

Now I'm back at it, and using g++, under Red Hat
Linux.  All my source modules compile, but I've
had to remark out a few lines dealing with my
user interface thread and some semaphore objects.
(So I can run test suites, but that's about it).

I've #included <pthread.h>, and replaced
the beginthread( ) call with
pthread_create(&thread_id,NULL,UIThread,NULL);
where UIThread is the name of my user interface
function.

One final step, I think:
I need to link the pthread library with my program.
I'm kind of new to Linux, but after poking around
a bit, the only thing I've found that remotely
resembles what I'm looking for is
/usr/lib/libpthread_p.a, but I'm not sure.

I assume the .a extension means that the file is
archived.  What function do I use to 'unarchive'?

Is this the file I need to link with my program?
If not, what is?  Either way, how do I link it with
my program?  I'm guessing that I just need to add
the object file into my make file.

Help *greatly* appreciated.

On a side note, g++ doesn't recognize the 'fcloseall( )'
function, but does recognize the 'fclose( )' function.
Does 'fcloseall( )' exist in Linux?  Maybe I'm not
including the right header...

Thanks again. :-/

--
James





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.