Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read controller events asynchronously #3

Open
Scindix opened this issue Dec 31, 2018 · 2 comments
Open

Read controller events asynchronously #3

Scindix opened this issue Dec 31, 2018 · 2 comments

Comments

@Scindix
Copy link

Scindix commented Dec 31, 2018

I'm trying to figure out if there is a way to use this library asynchronously.
Currently I'm using the following (utilizing c++11 threads):

void handleController()
{
    while(running)
    {
        SteamControllerEvent sce;
        for(auto dev : devices)
            SteamController_ReadEvent(dev, &sce);
    }
}
// ...
std::thread hC(handleController);
// do something
hC.join();

The problem is that SteamController_ReadEvent blocks all execution until the next event is received. Which means that my application does not close until I press some button or move the joystick.
I also tried adding the following before hC.join(); hoping that it would cancel reading the events, but to no avail.

for(auto dev : devices)
    SteamController_Close(dev);

What's the intended way to do this? Or is this even possible?

@glani
Copy link

glani commented Jul 31, 2019

@Scindix I experienced the same issue. I decided to move async read for windows os to separate project and it takes responsibility. This is not the purpose of this project I guess you have to manage async reading on your own.

@diiigle
Copy link

diiigle commented Jun 10, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants