MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / GlobalPortLock

Method GlobalPortLock

src/remote/server/server.cpp:877–901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875{
876public:
877 explicit GlobalPortLock(int id)
878 : handle(INVALID_HANDLE_VALUE)
879 {
880 if (id)
881 {
882 TEXT mutex_name[MAXPATHLEN];
883 fb_utils::snprintf(mutex_name, sizeof(mutex_name), "FirebirdPortMutex%d", id);
884 fb_utils::prefix_kernel_object_name(mutex_name, sizeof(mutex_name));
885
886 if (!(handle = CreateMutex(ISC_get_security_desc(), FALSE, mutex_name)))
887 {
888 // MSDN: if the caller has limited access rights, the function will fail with
889 // ERROR_ACCESS_DENIED and the caller should use the OpenMutex function.
890 if (GetLastError() == ERROR_ACCESS_DENIED)
891 system_call_failed::raise("CreateMutex - cannot open existing mutex");
892 else
893 system_call_failed::raise("CreateMutex");
894 }
895
896 if (WaitForSingleObject(handle, INFINITE) == WAIT_FAILED)
897 {
898 system_call_failed::raise("WaitForSingleObject");
899 }
900 }
901 }
902
903 ~GlobalPortLock()
904 {

Callers

nothing calls this directly

Calls 8

ISC_get_security_descFunction · 0.85
raiseFunction · 0.85
snprintfFunction · 0.50
openFunction · 0.50
enterMethod · 0.45
printfMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected