-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from leapmotion/bug-reentrantinitiate
Fix CoreContext::Initiate reentrant deadlock
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved. | ||
#include "stdafx.h" | ||
#include <autowiring/autowiring.h> | ||
#include <autowiring/CoreRunnable.h> | ||
|
||
class CoreRunnableTest: | ||
public testing::Test | ||
{}; | ||
|
||
class StartsSubcontextWhileStarting: | ||
public CoreRunnable | ||
{ | ||
public: | ||
AutoCreateContext m_myContext; | ||
|
||
bool Start(std::shared_ptr<Object> outstanding) override { | ||
m_myContext->Initiate(); | ||
return true; | ||
} | ||
|
||
void Stop(bool graceful) override {} | ||
bool IsRunning(void) const override { return false; } | ||
bool ShouldStop(void) const override { return true; } | ||
void Wait(void) override {} | ||
}; | ||
|
||
TEST_F(CoreRunnableTest, CanStartSubcontextWhileInitiating) { | ||
AutoRequired<StartsSubcontextWhileStarting>(); | ||
AutoCurrentContext()->Initiate(); | ||
} |