Blender  V3.3
btThreadSupportInterface.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2018 Erwin Coumans http://bulletphysics.com
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 #ifndef BT_THREAD_SUPPORT_INTERFACE_H
17 #define BT_THREAD_SUPPORT_INTERFACE_H
18 
20 {
21 public:
23  virtual ~btCriticalSection() {}
24 
25  virtual void lock() = 0;
26  virtual void unlock() = 0;
27 };
28 
30 {
31 public:
33 
34  virtual int getNumWorkerThreads() const = 0; // number of worker threads (total number of logical processors - 1)
35  virtual int getCacheFriendlyNumThreads() const = 0; // the number of logical processors sharing a single L3 cache
36  virtual int getLogicalToPhysicalCoreRatio() const = 0; // the number of logical processors per physical processor (usually 1 or 2)
37  virtual void runTask(int threadIndex, void* userData) = 0;
38  virtual void waitForAllTasks() = 0;
39 
41  virtual void deleteCriticalSection(btCriticalSection* criticalSection) = 0;
42 
43  typedef void (*ThreadFunc)(void* userPtr);
44 
46  {
47  ConstructionInfo(const char* uniqueName,
48  ThreadFunc userThreadFunc,
49  int threadStackSize = 65535)
50  : m_uniqueName(uniqueName),
51  m_userThreadFunc(userThreadFunc),
52  m_threadStackSize(threadStackSize)
53  {
54  }
55 
56  const char* m_uniqueName;
59  };
60 
62 };
63 
64 #endif //BT_THREAD_SUPPORT_INTERFACE_H
virtual void lock()=0
virtual void unlock()=0
void(* ThreadFunc)(void *userPtr)
virtual int getCacheFriendlyNumThreads() const =0
virtual int getLogicalToPhysicalCoreRatio() const =0
virtual void waitForAllTasks()=0
virtual void runTask(int threadIndex, void *userData)=0
virtual btCriticalSection * createCriticalSection()=0
virtual int getNumWorkerThreads() const =0
static btThreadSupportInterface * create(const ConstructionInfo &info)
virtual void deleteCriticalSection(btCriticalSection *criticalSection)=0
SyclQueue void void size_t num_bytes void
ConstructionInfo(const char *uniqueName, ThreadFunc userThreadFunc, int threadStackSize=65535)