Input: multithreaded handlers

Implements naive multithreading for input handlers.
This commit is contained in:
Megamouse 2022-01-28 00:09:11 +01:00
parent ec3e8de780
commit d6597038ee
9 changed files with 136 additions and 8 deletions

View file

@ -253,6 +253,8 @@ struct cfg_root : cfg::node
cfg::_enum<buzz_handler> buzz{ this, "Buzz emulated controller", buzz_handler::null };
cfg::_enum<turntable_handler> turntable{this, "Turntable emulated controller", turntable_handler::null};
cfg::_enum<ghltar_handler> ghltar{this, "GHLtar emulated controller", ghltar_handler::null};
cfg::_enum<pad_handler_mode> pad_mode{this, "Pad handler mode", pad_handler_mode::single_threaded, true};
cfg::uint<0, 100'000> pad_sleep{this, "Pad handler sleep (microseconds)", 1'000, true};
} io{ this };
struct node_sys : cfg::node

View file

@ -385,6 +385,21 @@ void fmt_class_string<move_handler>::format(std::string& out, u64 arg)
});
}
template <>
void fmt_class_string<pad_handler_mode>::format(std::string& out, u64 arg)
{
format_enum(out, arg, [](auto value)
{
switch (value)
{
case pad_handler_mode::single_threaded: return "Single-threaded";
case pad_handler_mode::multi_threaded: return "Multi-threaded";
}
return unknown;
});
}
template <>
void fmt_class_string<buzz_handler>::format(std::string& out, u64 arg)
{

View file

@ -135,6 +135,12 @@ enum class microphone_handler
rocksmith,
};
enum class pad_handler_mode
{
single_threaded, // All pad handlers run on the same thread sequentially.
multi_threaded // Each pad handler has its own thread.
};
enum class video_resolution
{
_1080,