Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

In Brew we use ishell_setimer with 0 time to get asynchronous flow...Brew also provides IThread for that purpose...

what are the advantage of using Ishell_setimer and what are the disadvantages.

what are the advantage of using IThread and what are the disadvantages.

ISHELL_SetTimer is used to do some task after specified time. if specified time is 0, callback function is called instantly which is same as normal function call.
Note the following:
Timer will expire at Current Time +
Timer callbacks are made in the application's task state. The system shields the application developer from managing non-task callbacks.
Any normal processing can be done in the callback. This includes drawing to the screen, writing to files, etc.
Timers do not repeat. The user must reset the timer if they desire a repeating timer.
Specifying the same callback/data pointers will automatically override a pending timer with the same callback/data pointers.
Upon termination of the currently active applet, the shell scans the timer list. If the terminated applet was deleted as a result of its termination (ie. its reference count went to 0), and an associated timer was found with the data pointer pointing to the IApplet, the timer is deleted.
Negative timeout values are treated the same as 0 timeout values
IThread:
IThread is a cooperatively-scheduled thread that layers over BREW's callback-based APIs. It exports the methods to start and stop threads and the methods necessary to implement blocking APIs when given an arbitrary callback-based API.
IThreads are not re-useable, for example: An _Start() may only be called once. After a thread returns from its start function, then calling an _Exit() or a _Stop() , the thread may not be restarter with a _Start().
http://www.devx.com/wireless/Article/32077

ISHELL_SetTimer is used to do some task after specified time. if specified time is 0, callback function is called instantly which is same as normal function call.
Note the following:
Timer will expire at Current Time +
Timer callbacks are made in the application's task state. The system shields the application developer from managing non-task callbacks.
Any normal processing can be done in the callback. This includes drawing to the screen, writing to files, etc.
Timers do not repeat. The user must reset the timer if they desire a repeating timer.
Specifying the same callback/data pointers will automatically override a pending timer with the same callback/data pointers.
Upon termination of the currently active applet, the shell scans the timer list. If the terminated applet was deleted as a result of its termination (ie. its reference count went to 0), and an associated timer was found with the data pointer pointing to the IApplet, the timer is deleted.
Negative timeout values are treated the same as 0 timeout values
IThread:
IThread is a cooperatively-scheduled thread that layers over BREW's callback-based APIs. It exports the methods to start and stop threads and the methods necessary to implement blocking APIs when given an arbitrary callback-based API.
IThreads are not re-useable, for example: An _Start() may only be called once. After a thread returns from its start function, then calling an _Exit() or a _Stop() , the thread may not be restarter with a _Start().
http://www.devx.com/wireless/Article/32077