You really only need the reference to the semaphore within the executable providing the API.
Basically, you could create a semaphore in the
COMPONENT_INIT section with an initial count of
1 then use that reference in your API function(s).
* Create a semaphore with an initial count of 1
* This signals that 1 resource (a single file) is available
void FileManager_StoreFile(const char* writeData)
* Pend (wait) on the semaphore using either:
* Note: the first client calling the API will `consume` the semaphore
// If le_sem above returned LE_OK, it is safe to `use` the resource.
FILE* fp = fopen(filename,“w+”);
// ... do stuff with the file, etc.
* *** <— Another client calls api ***
* Other clients won't be able to acquire the resource until
* the `consuming` client releases (posts) it.
* The behavior will depend on which `waiting` method you chose to implement.
// Finally, Post the semaphore so other clients may `use` it.