The Source for Java Technology Collaboration

Home » java.net Forums » Phone ME » phoneME Feature software

Thread: javacall and MT safe

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
This question is not answered. Helpful answers available: 2. Correct answers available: 1.

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 1 - Last Post: Aug 14, 2008 2:17 AM by: danila Threads: [ Previous | Next ]
chukmunnlee

Posts: 18
javacall and MT safe
Posted: Aug 9, 2008 7:08 PM
 
  Click to reply to this thread Reply

Hi

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.

Thanks

Regards
Chuk

danila

Posts: 129
Re: javacall and MT safe
Posted: Aug 14, 2008 2:17 AM   in response to: chukmunnlee
 
  Click to reply to this thread Reply

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
http://java.sun.com/javame/reference/docs/cldc-hi/doc/architecture/html/chapter5.html#Z400062e441123
http://java.sun.com/javame/reference/docs/cldc-hi/doc/porting/html/chapter4.html#d0e1551

Danila




 XML java.net RSS