Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Posix Threads & Windows



There are a few important differences between "PThreads: and Windows threads.

If you are interested I have a C++ class library that abstracts
semaphores, mutexes, and threads so that each system uses native threads.
It does a lot of silly stuff like this:
int MThread::run(Boolean fdetach)
{
#ifdef POSIX
        int err;
        m_status = THSTAT_PRESTART;
        m_fDelOnExit = fdetach;

        err = pthread_create(&m_pthread_t, &m_thread_attr,&thunk,(void
*)this);

        assert( err == 0);

        if(fdetach)
                pthread_detach(m_pthread_t);
        return err;
#endif
#ifdef WIN32
        m_pthread_t = _beginthread(&thunk, m_stacksize, (void *) this);
        return (m_pthread_t > 0) ? 0 : errno;
#endif
}


> Message: 5
> Date: Wed, 21 Dec 2005 14:17:29 -0500 (EST)
> From: Anthony Gabrielson <agabriel at home.tzo.org>
> Subject: Posix Threads & Windows
> To: discuss at blu.org
> Message-ID: <Pine.BSO.4.56.0512211412180.1073 at home.tzo.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
> Hello,
> 	Quick question, I need to write a thread/sema app that uses POSIX
> calls under windows.  I want to use the posix calls since within the next
> few months this will be running under Linux ( I need to sort the Linux
> drivers and data acq API out before I can even think about this app with
> Linux).  So I would like to use SFU with Vis C and I just wanted to see if
> anyone had any experience getting that going that could share with me.
>
> 	I really have no desire to right now to learn the MS approach to
> threads and IPC so this would be a great help to me.
>
> Happy Holidays!
>
> Anthony





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org