blob: 20757c8fd93877d1ab4c76fc4fe9da572da69563 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "threads/CriticalSection.h"
#include <chrono>
#include <string>
#include <vector>
// forward
class LibraryLoader;
class CSectionLoader
{
public:
class CDll
{
public:
std::string m_strDllName;
long m_lReferenceCount;
LibraryLoader *m_pDll;
std::chrono::time_point<std::chrono::steady_clock> m_unloadDelayStartTick;
bool m_bDelayUnload;
};
CSectionLoader(void);
virtual ~CSectionLoader(void);
static LibraryLoader* LoadDLL(const std::string& strSection, bool bDelayUnload=true, bool bLoadSymbols=false);
static void UnloadDLL(const std::string& strSection);
static void UnloadDelayed();
void UnloadAll();
protected:
std::vector<CDll> m_vecLoadedDLLs;
CCriticalSection m_critSection;
};
extern CSectionLoader g_sectionLoader;
|