| 123456789101112131415161718192021222324252627 |
- //
- // thread_safe.h
- // shared_random_generator
- //
- // Created by Sam Jaffe on 3/19/23.
- // Copyright © 2023 Sam Jaffe. All rights reserved.
- //
- #pragma once
- #include <mutex>
- #include <random/device.h>
- namespace engine::random {
- class ThreadSafeDevice : public Device {
- private:
- std::mutex mutex_;
- std::unique_ptr<Device> impl_;
- public:
- ThreadSafeDevice(std::unique_ptr<Device> impl);
- uint32_t operator()() final;
- };
- }
|