Page 1 of 1

Is libInit() protected from switching i.e not running multitask

Posted: Wed Oct 30, 2024 4:31 pm
by gdridi
Hello!

I see difference between running my library between AOS4.1FinalEditionUpdate0 and AOS4.1FEUpdate2

Is there a Forbid() done by the Kernel when libInit() is called to initialize library code ? That was removed in AOS4.1FinalEditionUpdate2 ?

This leads to instability when launching multiple instances of my library at the same time. So libInit() must be protected by a Forbid().

This could explain mysterious bug ?
When launching multiple instances of program in parallel that use a same library.

Sincerely yours,

DGILLES

Re: Is libInit() protected from switching i.e not running multitask

Posted: Wed Mar 19, 2025 2:14 pm
by Hypex
I don't see any indication from OS3 or OS4 documentation you need to isolate the libInit() in a Forbid()/Permit() lock. It's possible there was a change in kernel routines that has the side effect of causing instability. However, if your library is having issues with parallelism, it might be a good idea to protect the libInit() routine regardless. This need not be a classic Forbid()/Permit() lock frowned upon. This could be a semaphore, but a semaphore has the same locking issue, since internally it's managed by another Forbid()/Permit() lock. So a mutex might be a better idea in this case for OS4 native code.