[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Threading with pthreading
From: |
Nicola Pero |
Subject: |
Re: Threading with pthreading |
Date: |
Fri, 12 Dec 2003 13:28:20 +0000 (GMT) |
> Hi all,
> I am really stuck while mixing C/pthreads and Objective C/NSThread
> calls, not even while generating a new thread and hooking it with the
> runtime (oh, I'm using gcc 3.3.2 and GNUStep 1.9.0, on a Linux box).
It seems you have two problems - one is mixing C with ObjC, and the other
one is mixing pthreads with NSThread.
I recommend attacking one problem at a time.
Mixing C and ObjC is usually simple - you can put your ObjC code into a
library (or module) and load/link/call it with/from the C code.
Mixing pthreads with NSThreads shouldn't be difficult.
When you start accessing ObjC from a pthread you yourself (or a
pthread-based threaded library) created, you need to call
GSRegisterCurrentThread() before using any ObjC code.
Once you're done with your ObjC code and you want to deregister the thread
with the ObjC machinery, you can call GSUnregisterCurrentThread().
I recommend attacking one problem at a time though.