I want to use a semaphore to ensure that only one of these methods is used at any one time. So if an AutoUpdate is in process, an attempt to update the app via SD card or TCP will be blocked.
I have a semaphore, which is initialised to 1.
Code: Select all
OSSemInit(&NBAppSem,1);
Code: Select all
update_shutdown_func = Shutdown;
Code: Select all
if ( OSSemPendNoWait(&NBAppSem) != OS_NO_ERR )
{
puts("AutoUpdate Blocked by NBAppSem\n");
return 0;
}
return 1;
From my initial look at the code that implements the AutoUpdate process in PC and NB, the process can be aborted by the PC without informing the NB.
So even if I have my own version of autoupdate.cpp where I Post to the NBAppSem inside DoExecute or inside DoStart in the case of UPDATE_RESULT_AUTH_FAILED or UPDATE_RESULT_AUTH_FAILED or UPDATE_RESULT_NOMEM or inside DoData in the case of UPDATE_RESULT_ERROR, it is still possible for an AutoUpdate to be initiated (causing Shutdown to be executed), and then the process aborted by the PC because of error or timeout, and the NB would not be aware that this has happened, and so would not know when to Post to the NBAppSem.
Does anyone have any ideas on how this might be done?