On 12/12/06, Trevor MacPhail <[EMAIL PROTECTED]> wrote:
As other people have already pointed out, Palm OS does not have any
support for multi threaded applications. There really only is even
one application running at a time. The closest you can get is using
events like sysNotifyIdleTimeEvent to repeatedly receive events from
the OS. However you still need to make sure that the amount of
processing you do each time you receive the event is small so that
you can return control back over to the OS so you can receive another
because the OS isn't going to preempt it. And so on.

this isn't entirely true.

however, from the licensing agreement developers have with the palmos
SDK; they are only to assume that the device is single threaded and
that your application can only run one thread at a time (UI thread).

unofficially...

when you do streaming audio; you have the main UI thread; and a limited
but reliable callback mechanism for audio generation (audio thread). this
itselfs proves that multi-threading does exist on the device itself - however,
its been built so that you should use it only for its intended task.

just take a look at you standard audio app - some have "play in background"
which means you can exit the audio app and be in the launcher (a diff app)
and the audio still plays.. mm.. multi-tasking? yes and no.

some people have been able to utilize the snd thread to do multi-tasking
stuff and not sound - but, there is actually an easier way; which is NOT
documented.

no-one has been truely listening to either myself or dmitry..

really unofficially:

the KERNEL has its own in-build threading model. this is why it can do
streaming audio the way it does. the KERNEL API's are not supposed to
be available to 3rd party developers - but, some people have figured it out
you can search the archives; some nice folk even made a semi-easy SDK
for you to use, but with that said.. good luck :)

you can create a function; that you can have the kernel call at a known
interval or time stamp. there are API's for this. however, this isn't true
multi-threading but its the basis of what you need to build such a model.

//------------------------------------------------------------------------
// PalmOS: Kernel Timer
//------------------------------------------------------------------------

typedef void (*KALTimerProcPtr)(void *userDataP);

extern Err     KALTimerCreate(UInt32 *, UInt32, KALTimerProcPtr, void *);
extern Err     KALTimerDelete(UInt32);
extern Err     KALTimerSet(UInt32, UInt32);

// :: PACE/KALTimerCreate.o
// :: PACE/KALTimerDelete.o
// :: PACE/KALTimerSet.o

its NOT callable via PACE - as i dont believe there are any documented trap
numbers; so, its something you can only run UNOFFICIALLY as native ARM.
ie: its a set of function pointers with r9 table lookups - confused?

if you are - then, the answer is there is no multi-threading in palmos.

if you are familiar with how to build native ARM applications without using
PACE in any way; and, understand how all this fits together - then, you have
a chance of doing multi-threading under Palm OS.

in my professional opinion; the original poster doesn't have these abilities.
so, NO NO and NO to his questions. palmsource will always have this stance
as well - because its NOT OFFICIALLY DOCUMENTED.

my understanding is that the KERNEL implements some form of green-threads
(managed threads); so, if any callback takes too much time - the device will
tend to lock up. so, if you put your code in an infinite loop - regardless where
you are - consider your application fried and reset is required.

some developers have managed how to tweak the os to their needs; but,
it causes the applications to be limited to a certain set of devices.

--
// Aaron Ardiri

--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to