Skip to content

Commit

Permalink
make the std::async calls deferred instead of async
Browse files Browse the repository at this point in the history
And fix a whitespace issue.
  • Loading branch information
llloret committed May 16, 2016
1 parent 39e34e4 commit 14e7f9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lang/LangSource/PyrObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,7 @@ void buildBigMethodMatrix()
ColumnDescriptor *sels = (ColumnDescriptor*)pyr_pool_compile->Alloc(numSelectors * sizeof(ColumnDescriptor));
MEMFAIL(sels);
#ifdef _MSC_VER
auto filledSelectorsFuture = std::async( std::launch::async, std::bind( &prepareColumnTable, sels, numSelectors ) );
auto filledSelectorsFuture = std::async( std::launch::deferred, std::bind( &prepareColumnTable, sels, numSelectors ) );
#else
auto filledSelectorsFuture = boost::async( pool, std::bind( &prepareColumnTable, sels, numSelectors ) );
#endif
Expand All @@ -1223,7 +1223,7 @@ void buildBigMethodMatrix()
return classes;
};
#ifdef _MSC_VER
auto filledClassIndices = std::async( std::launch::async, fillClassIndices, classes);
auto filledClassIndices = std::async( std::launch::deferred, fillClassIndices, classes);
#else
auto filledClassIndices = boost::async( pool, fillClassIndices, classes);
#endif
Expand Down Expand Up @@ -1253,7 +1253,7 @@ void buildBigMethodMatrix()
for( size_t beginSelectorIndex : boost::irange(selectorsPerJob, numSelectors, selectorsPerJob) ) {
size_t endSelectorIndex = std::min( beginSelectorIndex + selectorsPerJob, numSelectors );
#ifdef _MSC_VER
auto future = std::async( std::launch::async, calcRowStats, bigTable, filledSelectors, numClasses, numSelectors, beginSelectorIndex, endSelectorIndex );
auto future = std::async( std::launch::deferred, calcRowStats, bigTable, filledSelectors, numClasses, numSelectors, beginSelectorIndex, endSelectorIndex );
#else
auto future = boost::async( pool, calcRowStats, bigTable, filledSelectors, numClasses, numSelectors, beginSelectorIndex, endSelectorIndex );
#endif
Expand All @@ -1264,7 +1264,7 @@ void buildBigMethodMatrix()

for( auto & future : columnDescriptorsWithStats ) {
#ifdef _MSC_VER
future.wait();
future.wait();
#else
while( !future.is_ready() )
pool.schedule_one_or_yield();
Expand Down Expand Up @@ -1440,7 +1440,7 @@ static size_t fillClassRow(const PyrClass *classobj, PyrMethod** bigTable, boost

VectorOfFutures subclassResults;
for( int subClassIndex : boost::irange(1, numSubclasses) ) {
auto subclassResult = std::async(std::launch::async, fillClassRow, slotRawClass(&subclasses->slots[subClassIndex]), bigTable);
auto subclassResult = std::async(std::launch::deferred, fillClassRow, slotRawClass(&subclasses->slots[subClassIndex]), bigTable);
subclassResults.emplace_back( std::move( subclassResult ) );
}

Expand Down

0 comments on commit 14e7f9f

Please sign in to comment.