Apply changes suggested in issue 161.

This commit is contained in:
castano 2011-04-30 23:13:07 +00:00
parent 5a892cfa7e
commit 4dee348b9e

View File

@ -18,8 +18,8 @@
// http://msdn.microsoft.com/en-us/library/dd504870.aspx // http://msdn.microsoft.com/en-us/library/dd504870.aspx
#if NV_OS_WIN32 && _MSC_VER >= 1600 #if NV_OS_WIN32 && _MSC_VER >= 1600
#define HAVE_PPL 1 #define HAVE_PPL 1
#include <array> //#include <array>
//#include <ppl.h> #include <ppl.h>
#endif #endif
// Intel Thread Building Blocks (TBB). // Intel Thread Building Blocks (TBB).
@ -81,24 +81,6 @@ namespace nvtt {
#if defined(HAVE_PPL) #if defined(HAVE_PPL)
class CountingIterator
{
public:
CountingIterator() : i(0) {}
CountingIterator(const CountingIterator & rhs) : i(0) {}
explicit CountingIterator(int x) : i(x) {}
const int & operator*() const { return i; }
CountingIterator & operator++() { i++; return *this; }
CountingIterator & operator--() { i--; return *this; }
bool operator==(const CountingIterator& o) const { return i == o.i; }
bool operator!=(const CountingIterator& o) const { return i != o.i; }
private:
int i;
};
struct TaskFunctor { struct TaskFunctor {
TaskFunctor(Task * task, void * context) : task(task), context(context) {} TaskFunctor(Task * task, void * context) : task(task), context(context) {}
void operator()(int n) const { void operator()(int n) const {
@ -113,16 +95,12 @@ namespace nvtt {
{ {
virtual void dispatch(Task * task, void * context, int count) virtual void dispatch(Task * task, void * context, int count)
{ {
CountingIterator begin(0);
CountingIterator end((int)count);
TaskFunctor func(task, context); TaskFunctor func(task, context);
Concurrency::parallel_for(0, count, func);
std::for_each(begin, end, func);
//parallel_for_each(begin, end, func);
} }
}; };
#endif #endif // HAVE_PPL
#if defined(HAVE_TBB) #if defined(HAVE_TBB)