feat: 实现Containers、Memory、Threading核心模块及单元测试
- Containers: String, Array, HashMap 容器实现及测试
- Memory: Allocator, LinearAllocator, PoolAllocator, ProxyAllocator, MemoryManager 实现及测试
- Threading: Mutex, SpinLock, ReadWriteLock, Thread, Task, TaskSystem 实现及测试
- 修复Windows平台兼容性: _aligned_malloc, std::hash特化
- 修复构建错误和测试用例问题
2026-03-13 20:37:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
namespace XCEngine {
|
|
|
|
|
namespace Threading {
|
|
|
|
|
|
|
|
|
|
class Mutex {
|
|
|
|
|
public:
|
|
|
|
|
Mutex() = default;
|
|
|
|
|
~Mutex() = default;
|
|
|
|
|
|
|
|
|
|
void Lock() { m_mutex.lock(); }
|
|
|
|
|
void Unlock() { m_mutex.unlock(); }
|
|
|
|
|
bool TryLock() { return m_mutex.try_lock(); }
|
|
|
|
|
|
2026-03-17 22:32:27 +08:00
|
|
|
void lock() const { m_mutex.lock(); }
|
|
|
|
|
void unlock() const { m_mutex.unlock(); }
|
|
|
|
|
bool try_lock() const { return m_mutex.try_lock(); }
|
feat: 实现Containers、Memory、Threading核心模块及单元测试
- Containers: String, Array, HashMap 容器实现及测试
- Memory: Allocator, LinearAllocator, PoolAllocator, ProxyAllocator, MemoryManager 实现及测试
- Threading: Mutex, SpinLock, ReadWriteLock, Thread, Task, TaskSystem 实现及测试
- 修复Windows平台兼容性: _aligned_malloc, std::hash特化
- 修复构建错误和测试用例问题
2026-03-13 20:37:08 +08:00
|
|
|
|
|
|
|
|
private:
|
2026-03-17 22:32:27 +08:00
|
|
|
mutable std::mutex m_mutex;
|
feat: 实现Containers、Memory、Threading核心模块及单元测试
- Containers: String, Array, HashMap 容器实现及测试
- Memory: Allocator, LinearAllocator, PoolAllocator, ProxyAllocator, MemoryManager 实现及测试
- Threading: Mutex, SpinLock, ReadWriteLock, Thread, Task, TaskSystem 实现及测试
- 修复Windows平台兼容性: _aligned_malloc, std::hash特化
- 修复构建错误和测试用例问题
2026-03-13 20:37:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Threading
|
|
|
|
|
} // namespace XCEngine
|