eliminated some hid-thread race conditions

This commit is contained in:
Jack Andersen
2015-04-22 14:46:32 -10:00
parent c1dc218bd1
commit 92e7c3fb04
12 changed files with 131 additions and 26 deletions

View File

@@ -12,14 +12,15 @@ public:
{}
void deviceConnected(CDeviceToken& tok)
{
printf("CONNECTED %s %s\n", tok.getVendorName().c_str(), tok.getProductName().c_str());
smashAdapter = dynamic_cast<CDolphinSmashAdapter*>(tok.openAndGetDevice());
}
void deviceDisconnected(CDeviceToken& tok)
void deviceDisconnected(CDeviceToken&, CDeviceBase* device)
{
printf("DISCONNECTED %s %s\n", tok.getVendorName().c_str(), tok.getProductName().c_str());
delete smashAdapter;
smashAdapter = NULL;
if (smashAdapter == device)
{
delete smashAdapter;
smashAdapter = NULL;
}
}
};