mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Signal: rename Signal to Signal_mt and Signal_st to Signal.
The single-threaded version is fine for most of the use cases we're planning on, and is half the size on most platforms.
This commit is contained in:
@@ -50,11 +50,11 @@ std::atomic<int> sum{0};
|
||||
|
||||
void f(int i) { sum += i; }
|
||||
|
||||
void emit_many(Signal<int>& sig) {
|
||||
void emit_many(Signal_mt<int>& sig) {
|
||||
for (int i = 0; i < 10000; ++i) sig(1);
|
||||
}
|
||||
|
||||
void connect_emit(Signal<int>& sig) {
|
||||
void connect_emit(Signal_mt<int>& sig) {
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
auto s = sig.connect_scoped(f);
|
||||
for (int j = 0; j < 100; ++j) sig(1);
|
||||
@@ -68,7 +68,7 @@ namespace wpi {
|
||||
TEST(Signal, ThreadedMix) {
|
||||
sum = 0;
|
||||
|
||||
Signal<int> sig;
|
||||
Signal_mt<int> sig;
|
||||
|
||||
std::array<std::thread, 10> threads;
|
||||
for (auto& t : threads) t = std::thread(connect_emit, std::ref(sig));
|
||||
@@ -79,7 +79,7 @@ TEST(Signal, ThreadedMix) {
|
||||
TEST(Signal, ThreadedEmission) {
|
||||
sum = 0;
|
||||
|
||||
Signal<int> sig;
|
||||
Signal_mt<int> sig;
|
||||
sig.connect(f);
|
||||
|
||||
std::array<std::thread, 10> threads;
|
||||
|
||||
Reference in New Issue
Block a user