Skip to content

Commit a7ffbb8

Browse files
committed
PROPOSAL: discard values if the queue is full
1 parent f5235ce commit a7ffbb8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: Arduino_Threads.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ class Shared // template definition
1414
}
1515
}
1616
T& operator= (const T& other) {
17-
val = other;
18-
T* obj = new T(val);
19-
queue->put(obj);
17+
if (!queue->full()) {
18+
val = other;
19+
T* obj = new T(val);
20+
queue->put(obj);
21+
}
2022
}
2123
T& peek() {
2224
return val;

0 commit comments

Comments
 (0)