Modernize atomics
- Based on C++11's `atomic` - Reworked `SafeRefCount` (based on the rewrite by @hpvb) - Replaced free atomic functions by the new `SafeNumeric<T>` - Replaced wrong cases of `volatile bool` by the new `SafeFlag` - Platform-specific implementations no longer needed Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
This commit is contained in:
parent
8870f43d74
commit
8e128726f0
58 changed files with 650 additions and 639 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#define AUDIO_STREAM_PREVIEW_H
|
||||
|
||||
#include "core/os/thread.h"
|
||||
#include "core/templates/safe_refcount.h"
|
||||
#include "scene/main/node.h"
|
||||
#include "servers/audio/audio_stream.h"
|
||||
|
||||
|
|
@ -60,9 +61,20 @@ class AudioStreamPreviewGenerator : public Node {
|
|||
Ref<AudioStreamPreview> preview;
|
||||
Ref<AudioStream> base_stream;
|
||||
Ref<AudioStreamPlayback> playback;
|
||||
volatile bool generating = false;
|
||||
SafeFlag generating;
|
||||
ObjectID id;
|
||||
Thread *thread = nullptr;
|
||||
|
||||
// Needed for the bookkeeping of the Map
|
||||
Preview &operator=(const Preview &p_rhs) {
|
||||
preview = p_rhs.preview;
|
||||
base_stream = p_rhs.base_stream;
|
||||
playback = p_rhs.playback;
|
||||
generating.set_to(generating.is_set());
|
||||
id = p_rhs.id;
|
||||
thread = p_rhs.thread;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
Map<ObjectID, Preview> previews;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue