Thanks to Keith, this problem's solution has been found (and a hairy one
it is! :) ).

Certain OSv3.5 versions hold the memory semaphore during notifications.
Bottom line: POSE can't do anything, and certain real devices crash if
you have an event loop inside a notification routine.

Here's what I did to "solve" the problem (note that I've not fully
researched the case of when MemSemaphoreRelease returns false):

In the event handler:


    ud->sema_bug = (os_version() == 0x305);
    if (ud->sema_bug) {
      if (MemSemaphoreRelease(false))
        ud->sema_bug = false;                                       /*
don't re-reserve it. This ROM isn't bad. */
      }


    Do our logic
    .
    .
    .


    if (ud->sema_bug)
      MemSemaphoreReserve(false);


Note: The os_version() routine's result is 0x305 in the case of
PalmOSv3.5, 0x400 in PalmOSv4.0, and 0x401 for PalmOSv4.1.

Good luck!

Alex


Thomas Ward wrote:
> 
> Hi,
> 
> I have an app compiled with GCC that uses the sysAppLaunchCmdNotify launch
> code with sysNotifyLateWakeupEvent. It works correctly except when running
> POSE with OS 3.5.2H. When I get sysNotifyLateWakeupEvent, I end up calling
> this routine:
> 
> static void message_dialog (void) {
>    FormPtr       dialog = FrmInitForm(message_form);
>    EventType     event;
> 
>    FrmSetEventHandler(dialog, (FormEventHandlerPtr) message_handler);
> 
>    MemSet(&event, sizeof(EventType), 0);
>    event.eType = frmOpenEvent;
>    event.data.frmLoad.formID = message_form;
>    EvtAddEventToQueue(&event);
> 
>    FrmDoDialog(dialog);
>    FrmDeleteForm(dialog);
>    }
> 
> The message_handler routine looks basically like this:
> 
> static Boolean message_handler (EventPtr event) {
>    FormPtr         frm = FrmGetActiveForm();
>    Boolean         handled = false;
> 
> HostTraceOutputTL(appErrorClass, "got event");
>    switch (event->eType) {
>       case ctlSelectEvent:
>          // handle controls here
>          break;
>       case frmOpenEvent:
>          show_message(frm);     // does a FrmDrawForm
> HostTraceOutputTL(appErrorClass, "finished");
>            handled = true;
>          break;
>       }
>    return handled;
>    }
> 
> When this runs in POSE with the Visor35Dbg.rom ROM file on a Win2k machine,
> I turn off the power, turn it back on, and get:
> 
> got event
> got event
> got event
> finished
> 
> my form appears, and everything seems to be OK. But, at this point, it's
> dead. I cannot tap on any buttons or do anything other than exit or reset
> POSE. And if I tap anywhere on the screen (I do *NOT* see another "got
> event") POSE is completely dead, and I cannot even exit or reset, and I have
> to kill the application in the Task Manager.
> 
> This only seems to happen with 3.5.2H. I am running with ALL debug checks
> enabled, but do not get any errors or warnings. I do not get this error on
> my m505 or on my T615. Anybody have any ideas what could be causing this or
> how I can track it down? I can't use POSE's logging feature, because POSE
> completely dies and no log file is created. Thanks.
> 
> Tom

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

Reply via email to