FF_CreateSemaphore()

From FullFAT

Jump to: navigation, search


Creates a Semaphore or Mutex object and returns a void casted pointer or handle to the object.

This function must be written by the developer to provide thread-safe integration with their platform.

Contents

Prototype

void *FF_CreateSemaphore(void);

Back to API.

The function is called, and a semaphore object is created.

Example

On windows this is done with the following code:

#include <windows.h>
 
void *FF_CreateSemaphore(void) {
	HANDLE hSem = CreateMutex(NULL, FALSE, NULL);//CreateSemaphore(NULL, 1, 1, NULL);
 
	return (void *) hSem;
}

Back to API.

Or Analog Devices VDK Kernel:

#include <VDK.h>
 
void *FF_CreateSemaphore(void) {
	// Call your OS's CreateSemaphore function
	//	
	VDK_SemaphoreID *mysem = malloc(sizeof(VDK_SemaphoreID));
 
	*mysem = VDK_CreateSemaphore(1, 1, 1, 0);
 
	return (void *) mysem;
 
}

Back to API.

NOTE

Examples for Linux are documented in the demo projects, and will be added here shortly.

These functions should NEVER be called by the developer! FullFAT will call you!

Back to API.

See Also



Personal tools