[openbeos] Re: app_server: MMX/SSE help wanted

  • From: "shatty" <shatty@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 10 Aug 2004 12:11:02 -0700

Hi Scott,

If all you need is pthread_create and pthread_join,
try these. (a couple of others tossed in for good 
measure)  These work well enough for me in my test
app, so perhaps they'll suit you.  (warning: I'm not
a pthreads hacker :-) )

Andrew
P.S. be sure to link to -lbe of course...


#include <OS.h>

typedef thread_id  pthread_t;

static int pthread_create(pthread_t * id, const char * thread_name, void * 
function(void *), void * arg) {
  *id = spawn_thread((thread_func)function, thread_name, B_NORMAL_PRIORITY, 
arg);
  return (id <= 0);
}

#define pthread_join   wait_for_thread

#define pthread_self() find_thread(NULL)
#define pthread_exit   exit_thread

static bool pthread_equal(pthread_t x, pthread_t y) {
        return (x == y);
}



-----Original Message-----
From: "Scott Donaldson" <a_nqe@xxxxxxxxxxx>
To: openbeos@xxxxxxxxxxxxx
Date: Tue, 10 Aug 2004 18:46:10 +0100
Subject: [openbeos] Re: app_server: MMX/SSE help wanted

Are the basic pthread_create and pthread_join functional? Because at the 
moment I really only need the most basic of threading (I'm just learning to 
use threading).




Other related posts: