xbmc
XHandle.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "XHandlePublic.h"
12 #include "threads/Condition.h"
13 #include "threads/CriticalSection.h"
14 
15 #include <list>
16 #include <string>
17 #include <vector>
18 
19 #include "PlatformDefs.h"
20 
21 struct CXHandle {
22 
23 public:
24  typedef enum { HND_NULL = 0, HND_FILE, HND_EVENT, HND_MUTEX, HND_FIND_FILE } HandleType;
25 
26  CXHandle();
27  explicit CXHandle(HandleType nType);
28  CXHandle(const CXHandle &src);
29 
30  virtual ~CXHandle();
31  void Init();
32  inline HandleType GetType() { return m_type; }
33  void ChangeType(HandleType newType);
34 
36  std::list<CXHandle*> m_hParents;
37 
38  // simulate mutex and critical section
39  CCriticalSection *m_hMutex;
40  int RecursionCount; // for mutex - for compatibility with TARGET_WINDOWS critical section
41  int fd;
42  bool m_bManualEvent;
43  time_t m_tmCreation;
44  std::vector<std::string> m_FindFileResults;
45  int m_nFindFileIterator;
46  std::string m_FindFileDir;
47  off64_t m_iOffset;
48  bool m_bCDROM;
49  bool m_bEventSet;
50  int m_nRefCount;
51  CCriticalSection *m_internalLock;
52 
53  static void DumpObjectTracker();
54 
55 protected:
56  HandleType m_type;
57  static int m_objectTracker[10];
58 
59 };
Definition: XHandle.h:21
This is a thin wrapper around std::condition_variable_any.
Definition: Condition.h:26