The HYIPCMutex is used to protect a shared resource from simultaneous access by processes or threads executing in the same or different VMs. Each process/thread must request and wait for the ownership of the shared resource before it can use that resource. It must also release the ownership of the resource as soon as it has finished using it so that other processes competing for the same resource are not delayed.
#include <windows.h>
#include "hyport.h"
Functions | |
I_32 VMCALL | hyipcmutex_acquire (struct HyPortLibrary *portLibrary, const char *name) |
Acquires a named mutex for the calling process. | |
I_32 VMCALL | hyipcmutex_release (struct HyPortLibrary *portLibrary, const char *name) |
Releases a named Mutex from the calling process. | |
void VMCALL | hyipcmutex_shutdown (struct HyPortLibrary *portLibrary) |
PortLibrary shutdown. | |
I_32 VMCALL | hyipcmutex_startup (struct HyPortLibrary *portLibrary) |
PortLibrary startup. |
I_32 VMCALL hyipcmutex_acquire | ( | struct HyPortLibrary * | portLibrary, | |
const char * | name | |||
) |
Acquires a named mutex for the calling process.
If a Mutex with the same Name already exists, the function opens the existing Mutex and tries to lock it. If another process already has the Mutex locked, the function will block indefinitely. If there is no Mutex with the same Name, the function will create it and lock it for the calling process of this function.
[in] | portLibrary | The port library |
[in] | name | Mutex to be acquired |
I_32 VMCALL hyipcmutex_release | ( | struct HyPortLibrary * | portLibrary, | |
const char * | name | |||
) |
Releases a named Mutex from the calling process.
If a Mutex with the same Name already exists, the function opens the existing Mutex and tries to unlock it. This function will fail if a Mutex with the given Name is not found or if the Mutex cannot be unlocked.
[in] | portLibrary | The port library |
[in] | name | Mutex to be released. |
void VMCALL hyipcmutex_shutdown | ( | struct HyPortLibrary * | portLibrary | ) |
PortLibrary shutdown.
This function is called during shutdown of the portLibrary. Any resources that were created by hyipcmutex_startup should be destroyed here.
[in] | portLibrary | The port library |
I_32 VMCALL hyipcmutex_startup | ( | struct HyPortLibrary * | portLibrary | ) |
PortLibrary startup.
This function is called during startup of the portLibrary. Any resources that are required for the IPC mutex operations may be created here. All resources created here should be destroyed in hyipcmutex_shutdown.
[in] | portLibrary | The port library |
Genereated on Tue Dec 9 14:12:59 2008 by Doxygen.
(c) Copyright 2005, 2008 The Apache Software Foundation or its licensors, as applicable.