Skip to content

Commit

Permalink
Merge pull request #64 from leapmotion/ref-tabstospaces
Browse files Browse the repository at this point in the history
Corrections on recent accidental introductions of tabs
  • Loading branch information
gtremper committed Aug 19, 2014
2 parents 2e17be8 + 5626e70 commit 959a4e7
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 56 deletions.
6 changes: 3 additions & 3 deletions autowiring/AutoNetServer.h
Expand Up @@ -14,9 +14,9 @@ class AutoNetServer:

public:
virtual ~AutoNetServer();
static AutoNetServer* New(void) {
return NewAutoNetServerImpl();
}
static AutoNetServer* New(void) {
return NewAutoNetServerImpl();
}

/// <summary>
/// Waits until resume message is sent from the visualizer
Expand Down
26 changes: 13 additions & 13 deletions autowiring/has_autofilter.h
Expand Up @@ -10,15 +10,15 @@
template<class W, class Selector>
struct has_valid_autofilter {
// Evaluates to false for W::AutoFilter(void), else to true.
static const int N = Decompose<decltype(&W::AutoFilter)>::N;
static const bool value = Decompose<decltype(&W::AutoFilter)>::N != 0;
static const int N = Decompose<decltype(&W::AutoFilter)>::N;
static const bool value = Decompose<decltype(&W::AutoFilter)>::N != 0;
};

// Specialization pertains only when W has no AutoFilter method.
template<class W>
struct has_valid_autofilter<W, std::false_type> {
static const int N = -1;
static const bool value = false;
static const int N = -1;
static const bool value = false;
};

//===========================================================
Expand All @@ -45,11 +45,11 @@ struct has_unambiguous_autofilter
template<class U>
static std::true_type select(unnamed_constant<decltype(&U::AutoFilter), &U::AutoFilter>*);

// Conveninece typedef used externally:
typedef has_valid_autofilter<T, decltype(select<T>(nullptr))> has_valid;
// Conveninece typedef used externally:
typedef has_valid_autofilter<T, decltype(select<T>(nullptr))> has_valid;

// Evaluates to true only if T includes a unique AutoFilter method with at least one argument.
static const bool value = has_valid::value;
static const bool value = has_valid::value;
};

class AutoPacket;
Expand All @@ -71,15 +71,15 @@ struct has_autofilter {
static const bool value = has_unambiguous_autofilter<T>::value;

// This class has at least one AutoFilter method
struct detect_ambiguous_autofilter: T, test_valid_autofilter {};
struct detect_ambiguous_autofilter: T, test_valid_autofilter {};

// Validate the case most likely to have problems
static_assert(has_unambiguous_autofilter<T>::has_valid::N != 0, "Cannot define AutoFilter(void), your AutoFilter routine must take at least one argument");
// Validate the case most likely to have problems
static_assert(has_unambiguous_autofilter<T>::has_valid::N != 0, "Cannot define AutoFilter(void), your AutoFilter routine must take at least one argument");

// Ensures a compiler error when the identification of T::AutoFilter is ambiguous.
// This cannot be in has_unambiguous_autofilter, since that would be recursive.
static_assert(
value || has_unambiguous_autofilter<detect_ambiguous_autofilter>::value,
"Cannot define more than one AutoFilter method and all AutoFilter methods must be public"
);
value || has_unambiguous_autofilter<detect_ambiguous_autofilter>::value,
"Cannot define more than one AutoFilter method and all AutoFilter methods must be public"
);
};
2 changes: 1 addition & 1 deletion src/autonet/AutoNetServerImpl.cpp
Expand Up @@ -59,7 +59,7 @@ AutoNetServerImpl::~AutoNetServerImpl()
}

AutoNetServer* NewAutoNetServerImpl(void) {
return new AutoNetServerImpl;
return new AutoNetServerImpl;
}

// CoreThread overrides
Expand Down
6 changes: 3 additions & 3 deletions src/autowiring/CMakeLists.txt
Expand Up @@ -123,16 +123,16 @@ set(Autowiring_Win_SRCS
)

set(Autowiring_Unix_SRCS
InterlockedExchangeUnix.cpp
InterlockedExchangeUnix.cpp
thread_specific_ptr_unix.h
)

set(Autowiring_Mac_SRCS
CoreThreadMac.cpp
CoreThreadMac.cpp
)

set(Autowiring_Linux_SRCS
CoreThreadLinux.cpp
CoreThreadLinux.cpp
)

ADD_MSVC_DISABLED_FILES("Unix Source" Autowiring_SRCS ${Autowiring_Unix_SRCS})
Expand Down
68 changes: 34 additions & 34 deletions src/autowiring/CoreJob.cpp
Expand Up @@ -20,27 +20,27 @@ void CoreJob::OnPended(std::unique_lock<std::mutex>&& lk){
// ready to initiate it.
return;

// Increment outstanding count because we now have an entry out in a thread pool
auto outstanding = m_outstanding;

if(!outstanding)
// We're currently signalled to stop, we must empty the queue and then
// return here--we can't accept dispatch delivery on a stopped queue.
while(!m_dispatchQueue.empty()) {
delete m_dispatchQueue.front();
m_dispatchQueue.pop_front();
}
else {
// Need to ask the thread pool to handle our events again:
m_curEventInTeardown = false;
m_curEvent = std::async(
std::launch::async,
[this, outstanding] () mutable {
this->DispatchAllAndClearCurrent();
outstanding.reset();
}
);
}
// Increment outstanding count because we now have an entry out in a thread pool
auto outstanding = m_outstanding;

if(!outstanding)
// We're currently signalled to stop, we must empty the queue and then
// return here--we can't accept dispatch delivery on a stopped queue.
while(!m_dispatchQueue.empty()) {
delete m_dispatchQueue.front();
m_dispatchQueue.pop_front();
}
else {
// Need to ask the thread pool to handle our events again:
m_curEventInTeardown = false;
m_curEvent = std::async(
std::launch::async,
[this, outstanding] () mutable {
this->DispatchAllAndClearCurrent();
outstanding.reset();
}
);
}
}

void CoreJob::DispatchAllAndClearCurrent(void) {
Expand All @@ -53,13 +53,13 @@ void CoreJob::DispatchAllAndClearCurrent(void) {
// between when we finished looping, and when we obtained the lock, and
// we don't want to exit our pool if that has happened.
std::lock_guard<std::mutex> lk(m_dispatchLock);
if(AreAnyDispatchersReady())
continue;
if(AreAnyDispatchersReady())
continue;

// Indicate that we're tearing down and will be done very soon. This is
// a signal to consumers that a call to m_curEvent.wait() will be nearly
// non-blocking.
m_curEventInTeardown = true;
// Indicate that we're tearing down and will be done very soon. This is
// a signal to consumers that a call to m_curEvent.wait() will be nearly
// non-blocking.
m_curEventInTeardown = true;
m_queueUpdated.notify_all();
break;
}
Expand All @@ -75,8 +75,8 @@ bool CoreJob::Start(std::shared_ptr<Object> outstanding) {

std::unique_lock<std::mutex> lk;
if(!m_dispatchQueue.empty())
// Simulate a pending event, because we need to set up our async:
OnPended(std::move(lk));
// Simulate a pending event, because we need to set up our async:
OnPended(std::move(lk));

return true;
}
Expand All @@ -90,14 +90,14 @@ void CoreJob::Stop(bool graceful) {
if(graceful)
// Pend a call which will invoke Abort once the dispatch queue is done:
DispatchQueue::Pend(
[this] {this->Abort();}
);
else
[this] {this->Abort();}
);
else
// Abort the dispatch queue so anyone waiting will wake up
Abort();

// Reset the outstanding pointer, we don't intend to hold it anymore:
m_outstanding.reset();
// Reset the outstanding pointer, we don't intend to hold it anymore:
m_outstanding.reset();

// Hit our condition variable to wake up any listeners:
std::lock_guard<std::mutex> lk(m_dispatchLock);
Expand Down
2 changes: 1 addition & 1 deletion src/autowiring/DispatchQueue.cpp
Expand Up @@ -81,7 +81,7 @@ void DispatchQueue::DispatchEventUnsafe(std::unique_lock<std::mutex>& lk) {
m_queueUpdated.notify_all();
}
),
(*thunk)();
(*thunk)();
}

bool DispatchQueue::DispatchEvent(void) {
Expand Down
2 changes: 1 addition & 1 deletion src/autowiring/stdafx.h
Expand Up @@ -7,7 +7,7 @@
#include <thread>
#define NOMINMAX
#endif
#ifndef _MSC_VER
#include <stdlib.h>
#endif
Expand Down

0 comments on commit 959a4e7

Please sign in to comment.