00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /* 00003 * This file is part of the LibreOffice project. 00004 * 00005 * This Source Code Form is subject to the terms of the Mozilla Public 00006 * License, v. 2.0. If a copy of the MPL was not distributed with this 00007 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 00008 * 00009 * This file incorporates work covered by the following license notice: 00010 * 00011 * Licensed to the Apache Software Foundation (ASF) under one or more 00012 * contributor license agreements. See the NOTICE file distributed 00013 * with this work for additional information regarding copyright 00014 * ownership. The ASF licenses this file to you under the Apache 00015 * License, Version 2.0 (the "License"); you may not use this file 00016 * except in compliance with the License. You may obtain a copy of 00017 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 00018 */ 00019 #ifndef _RTL_UNLOAD_H_ 00020 #define _RTL_UNLOAD_H_ 00021 00022 #include "sal/config.h" 00023 00024 #include "osl/interlck.h" 00025 #include "osl/module.h" 00026 #include "osl/time.h" 00027 #include "sal/saldllapi.h" 00028 #include "sal/types.h" 00029 00099 #define COMPONENT_CANUNLOAD "component_canUnload" 00100 typedef sal_Bool (SAL_CALL * component_canUnloadFunc)( TimeValue* pTime); 00101 00102 00105 #ifdef __cplusplus 00106 extern "C" 00107 { 00108 #endif 00109 00160 SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_registerModuleForUnloading( oslModule module); 00161 00173 SAL_DLLPUBLIC void SAL_CALL rtl_unregisterModuleForUnloading( oslModule module); 00199 SAL_DLLPUBLIC void SAL_CALL rtl_unloadUnusedModules( TimeValue* libUnused); 00200 00206 typedef void (SAL_CALL *rtl_unloadingListenerFunc)(void* id); 00221 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_addUnloadingListener( rtl_unloadingListenerFunc callback, void* _this); 00222 00231 SAL_DLLPUBLIC void SAL_CALL rtl_removeUnloadingListener( sal_Int32 cookie ); 00232 00233 00263 typedef struct _rtl_ModuleCount 00264 { 00265 void ( SAL_CALL * acquire ) ( struct _rtl_ModuleCount * that ); 00266 void ( SAL_CALL * release ) ( struct _rtl_ModuleCount * that ); 00267 }rtl_ModuleCount; 00268 00269 00270 #define MODULE_COUNT_INIT \ 00271 { {rtl_moduleCount_acquire,rtl_moduleCount_release}, rtl_moduleCount_canUnload, 0, {0, 0}} 00272 00280 typedef struct _rtl_StandardModuleCount 00281 { 00282 rtl_ModuleCount modCnt; 00283 sal_Bool ( *canUnload ) ( struct _rtl_StandardModuleCount* a, TimeValue* libUnused); 00284 oslInterlockedCount counter; 00285 TimeValue unusedSince; 00286 } rtl_StandardModuleCount; 00287 00291 SAL_DLLPUBLIC void rtl_moduleCount_acquire(rtl_ModuleCount * that ); 00296 SAL_DLLPUBLIC void rtl_moduleCount_release( rtl_ModuleCount * that ); 00297 00301 SAL_DLLPUBLIC sal_Bool rtl_moduleCount_canUnload( rtl_StandardModuleCount * that, TimeValue* libUnused); 00302 00303 00304 #ifdef __cplusplus 00305 } 00306 #endif 00307 00308 00309 #endif 00310 00311 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */