Skip to content

Commit

Permalink
Place all variables in enki namespace to resolve collisions. Potentia…
Browse files Browse the repository at this point in the history
…l fix for #43
  • Loading branch information
dougbinks committed Oct 28, 2019
1 parent fb1151f commit aae917a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/TaskScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@

using namespace enki;


static const uint32_t PIPESIZE_LOG2 = 8;
static const uint32_t SPIN_COUNT = 10;
static const uint32_t SPIN_BACKOFF_MULTIPLIER = 100;
static const uint32_t MAX_NUM_INITIAL_PARTITIONS = 8;
static const uint32_t CACHE_LINE_SIZE = 64; // awaiting std::hardware_constructive_interference_size
namespace enki
{
static const uint32_t PIPESIZE_LOG2 = 8;
static const uint32_t SPIN_COUNT = 10;
static const uint32_t SPIN_BACKOFF_MULTIPLIER = 100;
static const uint32_t MAX_NUM_INITIAL_PARTITIONS = 8;
static const uint32_t CACHE_LINE_SIZE = 64; // awaiting std::hardware_constructive_interference_size
};

// thread_local not well supported yet by C++11 compilers.
#ifdef _MSC_VER
Expand Down Expand Up @@ -82,9 +84,9 @@ namespace enki
struct ThreadDataStore
{
std::atomic<ThreadState> threadState;
char prevent_false_Share[ CACHE_LINE_SIZE - sizeof(std::atomic<ThreadState>) ];
char prevent_false_Share[ enki::CACHE_LINE_SIZE - sizeof(std::atomic<ThreadState>) ];
};
static_assert( sizeof( ThreadDataStore ) >= CACHE_LINE_SIZE, "ThreadDataStore may exhibit false sharing" );
static_assert( sizeof( ThreadDataStore ) >= enki::CACHE_LINE_SIZE, "ThreadDataStore may exhibit false sharing" );

class PinnedTaskList : public LocklessMultiWriteIntrusiveList<IPinnedTask> {};

Expand Down

0 comments on commit aae917a

Please sign in to comment.