diff options
Diffstat (limited to 'sal')
-rw-r--r-- | sal/inc/rtl/unload.h | 66 | ||||
-rw-r--r-- | sal/osl/all/compat.cxx | 25 | ||||
-rw-r--r-- | sal/rtl/unload.cxx | 76 |
3 files changed, 41 insertions, 126 deletions
diff --git a/sal/inc/rtl/unload.h b/sal/inc/rtl/unload.h index 0bbc414e792d..118b5cce9127 100644 --- a/sal/inc/rtl/unload.h +++ b/sal/inc/rtl/unload.h @@ -24,3 +24,2 @@ #include "osl/interlck.h" -#include "osl/module.h" #include "osl/time.h" @@ -29,4 +28,6 @@ -/** C-interface for a module reference counting - */ +/** @file + Backwards-compatibility remainders of a removed library unloading feature. +*/ + #ifdef __cplusplus @@ -36,30 +37,5 @@ extern "C" -/** -Pointers to <code>rtl_ModuleCount</code> are passed as arguments to the default factory creator -functions: <code>createSingleComponentFactory</code>, <code>createSingleFactory</code>, -<code>createOneInstanceFactory</code>. -The factory implementation is calling <code>rtl_ModuleCount.acquire</code> when it is being -constructed and it is calling <code>rtl_ModuleCount.release</code>. The implementations of -<code>acquire</code> -and <code>release</code> should influence the return value of <code>component_canUnload</code> -in a way that it -returns <code>sal_False</code> after <code>acquire</code> has been called. That is the module will not be unloaded -once a default factory has been created. A call to <code>release</code> may cause -<code>component_canUnload</code> to return <code>sal_False</code>, but only if there are -no object alive which -originated from the module. These objects are factory instances and the service instances -which have been created by these factories. -<p> -It is not necessary to synchronize <code>acquire</code> and <code>release</code> as a whole. -Simply sychronize the -access to a counter variable, e.g. the <code>rtl_moduleCount_release</code> implementation: -<pre> -extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that ) -{ - rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that; - osl_atomic_increment( &pMod->counter); -} -</pre> -The SAL library offers functions that can be used for <code>acquire</code> and <code>release</code>. See struct -<code>_rtl_StandardModuleCount</code>. +/** Backwards-compatibility remainder of a removed library unloading feature. + + @deprecated Do not use. */ @@ -71,3 +47,6 @@ typedef struct _rtl_ModuleCount +/** Backwards-compatibility remainder of a removed library unloading feature. + @deprecated Do not use. +*/ #define MODULE_COUNT_INIT \ @@ -75,8 +54,5 @@ typedef struct _rtl_ModuleCount -/** -This struct can be used to implement the unloading mechanism. To make a UNO library -unloadable create one global instance of this struct in the module. To initialize it one -uses the MODULE_COUNT_INIT macro. +/** Backwards-compatibility remainder of a removed library unloading feature. -<pre>rtl_StandardModuleCount globalModuleCount= MODULE_COUNT_INIT</pre>; + @deprecated Do not use. */ @@ -90,9 +66,11 @@ typedef struct _rtl_StandardModuleCount -/** Default implementation for <code>rtl_ModuleCount.acquire</code>. Use this function along with -<code>rtl_StandardModuleCount</code>. +/** Backwards-compatibility remainder of a removed library unloading feature. + + @deprecated Do not use. */ SAL_DLLPUBLIC void rtl_moduleCount_acquire(rtl_ModuleCount * that ); -/** Default implementation for <code>rtl_ModuleCount.release</code>. -Use this function along with -<code>rtl_StandardModuleCount</code>. + +/** Backwards-compatibility remainder of a removed library unloading feature. + + @deprecated Do not use. */ @@ -100,4 +78,5 @@ SAL_DLLPUBLIC void rtl_moduleCount_release( rtl_ModuleCount * that ); -/** Default implementation for <code>component_canUnload</code>. Use this function along with -<code>rtl_StandardModuleCount</code>. +/** Backwards-compatibility remainder of a removed library unloading feature. + + @deprecated Do not use. */ @@ -105,3 +84,2 @@ SAL_DLLPUBLIC sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that - #ifdef __cplusplus diff --git a/sal/osl/all/compat.cxx b/sal/osl/all/compat.cxx index 12f0da13fade..2f86771bb753 100644 --- a/sal/osl/all/compat.cxx +++ b/sal/osl/all/compat.cxx @@ -41,2 +41,8 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL osl_tryToAcquireSemaphore(void *) { +SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_addUnloadingListener( + void (SAL_CALL *)(void *), void *) +{ + for (;;) { std::abort(); } // avoid "must return a value" warnings +} + SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_compareMemory( @@ -69,6 +75,2 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_moveMemory( -SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_zeroMemory(void *, sal_Size) { - std::abort(); -} - SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL rtl_registerModuleForUnloading(oslModule) @@ -78,4 +80,3 @@ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL rtl_registerModuleForUnloading(oslModule) -SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unregisterModuleForUnloading(oslModule) -{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_removeUnloadingListener(sal_Int32) { std::abort(); @@ -83,4 +84,3 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unregisterModuleForUnloading(oslModule) -SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unloadUnusedModules(TimeValue *) -{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unloadUnusedModules(TimeValue *) { std::abort(); @@ -88,10 +88,7 @@ SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unloadUnusedModules(TimeValue *) -typedef void (SAL_CALL *rtl_unloadingListenerFunc)(void *id); -SAL_DLLPUBLIC_EXPORT sal_Int32 SAL_CALL rtl_addUnloadingListener(rtl_unloadingListenerFunc, void *) -{ - for (;;) { std::abort(); } // avoid "must return a value" warnings +SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_unregisterModuleForUnloading(oslModule) { + std::abort(); } -SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_removeUnloadingListener(sal_Int32) -{ +SAL_DLLPUBLIC_EXPORT void SAL_CALL rtl_zeroMemory(void *, sal_Size) { std::abort(); diff --git a/sal/rtl/unload.cxx b/sal/rtl/unload.cxx index dd8ee23b49bc..0b5bc2e79d27 100644 --- a/sal/rtl/unload.cxx +++ b/sal/rtl/unload.cxx @@ -19,75 +19,15 @@ -#include <rtl/unload.h> +#include "sal/config.h" -#include <rtl/ustring.hxx> -#include <rtl/instance.hxx> -#include <osl/mutex.hxx> +#include "osl/time.h" +#include "rtl/unload.h" -using osl::MutexGuard; +extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount *) {} -//---------------------------------------------------------------------------- +extern "C" void rtl_moduleCount_release(rtl_ModuleCount *) {} -#ifndef DISABLE_DYNLOADING - -namespace -{ - class theUnloadingMutex : public rtl::Static<osl::Mutex, theUnloadingMutex>{}; -} - -static osl::Mutex& getUnloadingMutex() -{ - return theUnloadingMutex::get(); -} - -#endif - -extern "C" void rtl_moduleCount_acquire(rtl_ModuleCount * that ) -{ -#ifdef DISABLE_DYNLOADING - (void) that; -#else - rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that; - osl_atomic_increment( &pMod->counter); -#endif -} - -extern "C" void rtl_moduleCount_release( rtl_ModuleCount * that ) -{ -#ifdef DISABLE_DYNLOADING - (void) that; -#else - rtl_StandardModuleCount* pMod= (rtl_StandardModuleCount*)that; - OSL_ENSURE( pMod->counter >0 , "library counter incorrect" ); - osl_atomic_decrement( &pMod->counter); - if( pMod->counter == 0) - { - MutexGuard guard( getUnloadingMutex()); - - if( sal_False == osl_getSystemTime( &pMod->unusedSince) ) - { - // set the time to 0 if we could not get the time - pMod->unusedSince.Seconds= 0; - pMod->unusedSince.Nanosec= 0; - } - } -#endif -} - -extern "C" sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue * libUnused) +extern "C" sal_Bool rtl_moduleCount_canUnload( + rtl_StandardModuleCount *, TimeValue *) { -#ifdef DISABLE_DYNLOADING - (void) that; - (void) libUnused; - return sal_False; -#else - if (that->counter == 0) - { - MutexGuard guard( getUnloadingMutex()); - if (libUnused && (that->counter == 0)) - { - memcpy(libUnused, &that->unusedSince, sizeof(TimeValue)); - } - } - return (that->counter == 0); -#endif + return false; } |