Skip to main content

javacall and MT safe

1 reply [Last post]
Joined: 2004-01-14


I'm currently porting the phoneme feature to a new platform. I've implemented the memory layer (eg. memory.c - javacall_memory_heap_allocate()) in javacall. The memory.c has some data structure that keeps track to the number of byte request by heap from PCSL.

Currently I've not done any locking when I access and modify these structure. Donuts seem to run okay on them (but then again Donuts is a single threaded app). My question is should I assume that in a multi threaded Java app, the JVM will call the lower level javacall (and also PCSL C) routines in a threadsafe manner or do I assume that calls are never threadsafe and my routines should do the right thing.



Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-09-25

Hi Chuk,

CLDC VM uses green threads, so all Java threads are created and managed
by the VM within a single OS thread. So the VM calls PCSL routines
from the same thread.

An exception to this rule is hybrid thread coding style that allows to use additional native OS threads to handle blocking calls.
For more details see