diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/Library_sal.mk | 1 | ||||
-rw-r--r-- | sal/osl/all/mutexshared.cxx | 20 | ||||
-rw-r--r-- | sal/osl/unx/mutex.cxx | 26 | ||||
-rw-r--r-- | sal/osl/w32/dllentry.cxx | 6 | ||||
-rw-r--r-- | sal/osl/w32/gmutex.hxx | 31 | ||||
-rw-r--r-- | sal/osl/w32/mutex.cxx | 6 |
6 files changed, 21 insertions, 69 deletions
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk index ddbd13a37392..fbc02f26d6da 100644 --- a/sal/Library_sal.mk +++ b/sal/Library_sal.mk @@ -85,6 +85,7 @@ $(eval $(call gb_Library_add_exception_objects,sal,\ sal/osl/all/filepath \ sal/osl/all/loadmodulerelative \ sal/osl/all/log \ + sal/osl/all/mutexshared \ sal/osl/all/signalshared \ sal/osl/all/utility \ sal/rtl/alloc_arena \ diff --git a/sal/osl/all/mutexshared.cxx b/sal/osl/all/mutexshared.cxx new file mode 100644 index 000000000000..3de7f99303a8 --- /dev/null +++ b/sal/osl/all/mutexshared.cxx @@ -0,0 +1,20 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <sal/config.h> + +#include <osl/mutex.hxx> + +oslMutex* SAL_CALL osl_getGlobalMutex() +{ + static osl::Mutex g_Mutex; + return &g_Mutex.mutex; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sal/osl/unx/mutex.cxx b/sal/osl/unx/mutex.cxx index 8cdc2a071376..1ca4958fd01d 100644 --- a/sal/osl/unx/mutex.cxx +++ b/sal/osl/unx/mutex.cxx @@ -160,30 +160,4 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutex pMutex) return false; } -static oslMutexImpl globalMutexImpl; - -static void globalMutexInitImpl() { - pthread_mutexattr_t attr; - if (pthread_mutexattr_init(&attr) != 0 || - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) || - pthread_mutex_init(&globalMutexImpl.mutex, &attr) != 0 || - pthread_mutexattr_destroy(&attr) != 0) - { - abort(); - } -} - -oslMutex * SAL_CALL osl_getGlobalMutex() -{ - /* necessary to get a "oslMutex *" */ - static oslMutex globalMutex = &globalMutexImpl; - - static pthread_once_t once = PTHREAD_ONCE_INIT; - if (pthread_once(&once, &globalMutexInitImpl) != 0) { - abort(); - } - - return &globalMutex; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/osl/w32/dllentry.cxx b/sal/osl/w32/dllentry.cxx index 3dba6d0e0c9f..a36e6cda8840 100644 --- a/sal/osl/w32/dllentry.cxx +++ b/sal/osl/w32/dllentry.cxx @@ -32,7 +32,6 @@ #include <osl/thread.h> #include "file_url.hxx" -#include "gmutex.hxx" #include <rtllifecycle.h> #include "thread.hxx" @@ -85,9 +84,6 @@ static BOOL WINAPI RawDllMain( HINSTANCE, DWORD fdwReason, LPVOID ) SetErrorMode( SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS ); #endif - /* initialize global mutex */ - g_Mutex = osl_createMutex(); - g_dwTLSTextEncodingIndex = TlsAlloc(); //We disable floating point exceptions. This is the usual state at program startup @@ -101,8 +97,6 @@ static BOOL WINAPI RawDllMain( HINSTANCE, DWORD fdwReason, LPVOID ) TlsFree( g_dwTLSTextEncodingIndex ); - osl_destroyMutex( g_Mutex ); - /* On a product build memory management finalization might diff --git a/sal/osl/w32/gmutex.hxx b/sal/osl/w32/gmutex.hxx deleted file mode 100644 index 013b4c178262..000000000000 --- a/sal/osl/w32/gmutex.hxx +++ /dev/null @@ -1,31 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SAL_OSL_W32_GMUTEX_HXX -#define INCLUDED_SAL_OSL_W32_GMUTEX_HXX - -#include <sal/config.h> - -#include <osl/mutex.h> - -extern oslMutex g_Mutex; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/sal/osl/w32/mutex.cxx b/sal/osl/w32/mutex.cxx index 31a9117a8c68..7de4c41eeaaf 100644 --- a/sal/osl/w32/mutex.cxx +++ b/sal/osl/w32/mutex.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include "gmutex.hxx" #include "system.h" #include <osl/mutex.h> @@ -86,9 +85,4 @@ sal_Bool SAL_CALL osl_releaseMutex(oslMutex Mutex) return true; } -/* initialized in dllentry.c */ -oslMutex g_Mutex; - -oslMutex* SAL_CALL osl_getGlobalMutex(void) { return &g_Mutex; } - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |