I finally had some time to look at this, and native_dispatch() had exactly what I was looking for.
However, I found a problem (at least for me) in THREADS_ALLOW(): when you call this macro, it checks if threads are enabled and the number of threads. If there are more than one thread, it unlocks the interpreter. The problem is, if you only have one thread when you call THREADS_ALLOW(), the lock doesn't get released and any code running in "temporary pike external" threads will just sit there. I imagine that this is only a problem for things like the java bridge and my code, but thought I'd mention it in case there's a simple solution. I have taken to starting a thread that simply enters a sleep () loop before creating my external threads, and this works just fine. Anyone have a better solution?
Bill
Thu Sep 7 10:25:01, Henrik Grubbström (Lysator) at Pike (-) developers forum wrote:
I'm working on an Objective-C bridge for Pike, and I've got a
problem
Take a look at src/modules/Java/jvm.c:native_dispatch().
Bill
pike-devel@lists.lysator.liu.se