Skip to content

Commit 43a0ef6

Browse files
committed
Remove unnecessary atomic.
1 parent 2206582 commit 43a0ef6

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

SerialPrograms/Source/Controllers/Schedulers/SuperscalarScheduler.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void SuperscalarScheduler::clear() noexcept{
3737
m_max_free_time = now;
3838
m_state_changes.clear();
3939
m_live_commands.clear();
40-
m_pending_clear.store(false, std::memory_order_release);
40+
m_pending_clear = false;
4141
}
4242

4343
SuperscalarScheduler::State SuperscalarScheduler::current_live_commands(){
@@ -163,7 +163,7 @@ void SuperscalarScheduler::process_schedule(Schedule& schedule){
163163
}
164164

165165
void SuperscalarScheduler::issue_wait_for_all(Schedule& schedule){
166-
if (m_pending_clear.load(std::memory_order_acquire)){
166+
if (m_pending_clear){
167167
clear();
168168
return;
169169
}
@@ -181,7 +181,7 @@ void SuperscalarScheduler::issue_nop(Schedule& schedule, WallDuration delay){
181181
if (delay <= WallDuration::zero()){
182182
return;
183183
}
184-
if (m_pending_clear.load(std::memory_order_acquire)){
184+
if (m_pending_clear){
185185
clear();
186186
}
187187
// cout << "issue_nop(): " << m_state_changes.size() << endl;
@@ -197,7 +197,7 @@ void SuperscalarScheduler::issue_nop(Schedule& schedule, WallDuration delay){
197197
process_schedule(schedule);
198198
}
199199
void SuperscalarScheduler::issue_wait_for_resource(Schedule& schedule, size_t resource_id){
200-
if (m_pending_clear.load(std::memory_order_acquire)){
200+
if (m_pending_clear){
201201
clear();
202202
return;
203203
}
@@ -221,7 +221,7 @@ void SuperscalarScheduler::issue_to_resource(
221221
std::shared_ptr<const SchedulerResource> resource,
222222
WallDuration delay, WallDuration hold, WallDuration cooldown
223223
){
224-
if (m_pending_clear.load(std::memory_order_acquire)){
224+
if (m_pending_clear){
225225
clear();
226226
}
227227

SerialPrograms/Source/Controllers/Schedulers/SuperscalarScheduler.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <memory>
1111
#include <set>
1212
#include <map>
13-
#include <atomic>
1413
#include "Common/Compiler.h"
1514
#include "Common/Cpp/Time.h"
1615
#include "Common/Cpp/AbstractLogger.h"
@@ -50,13 +49,8 @@ class SuperscalarScheduler{
5049
public:
5150
SuperscalarScheduler(Logger& logger, WallDuration flush_threshold);
5251

53-
54-
public:
55-
// This is intended to be run on a different thread from the functions in
56-
// the next section. So it is safe to run from anywhere.
57-
5852
void clear_on_next(){
59-
m_pending_clear.store(true, std::memory_order_release);
53+
m_pending_clear = true;
6054
}
6155

6256

@@ -111,7 +105,7 @@ class SuperscalarScheduler{
111105
// much time.
112106
const WallDuration m_flush_threshold;
113107

114-
std::atomic<bool> m_pending_clear;
108+
bool m_pending_clear;
115109

116110
// The construction time of this object. This is only used for debugging
117111
// purposes since it lets you print wall times relative to this.

SerialPrograms/Source/Controllers/StandardHid/StandardHid_Keyboard.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ class Keyboard : public AbstractController{
4747
public:
4848
// Standard Commands
4949

50+
// Note that only 6 keys (not counting modifiers) can be communicated at
51+
// once over the HID protocol. If you hold down more than 6, only the first
52+
// 6 chronologically will be applied.
53+
5054
virtual void issue_key(
5155
const Cancellable* cancellable,
5256
Milliseconds delay, Milliseconds hold, Milliseconds cooldown,

0 commit comments

Comments
 (0)