Updating app from Legato thread


#1

I am trying to update app using Update API.
When I use Update API from main thread calling

le_update_AddProgressHandler(updateProgressHandler, NULL);
le_update_Start(fd);
and updateProgressHandler calls le_update_Install();

everything goes well and my HelloWorld application is installed. Problem starts when I try to call these functions from legato thread. So my code looks something like this:

fwUpdateThread_mainFunc() {
      le_update_ConnectService();
      le_update_AddProgressHandler(updateProgressHandler, NULL);
      le_update_Start(fd);
}

le_thread_Create (“FWUpdateThread”, fwUpdateThread_mainFunc, (void*)(&m_fwUpdateStruct));
le_thread_Start (m_refThread);

Program never enters updateProgressHandler and thus le_update_Install is never called and program just hangs and nothing happens… Like updates of progress of event are never sent… I tried calling le_event_RunLoop inside fwUpdateThread_mainFunc, but it didn’t help.

Anybody knows why this happens?

My code is more or less like the one from documenatation: https://docs.legato.io/18_06/c_update.html


#2

Solution was to call le_event_RunLoop, I called it on wrong place…