- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am a noobie concerning threading, so I thought that I would start with Threading Building Blocks for my application. I 'think' I am creating things appropriately, but I am getting compilier errors (on VS 2005 - Error C2784). I am able to create the map and populate it, but I don't think I am doing the parallel iteration correctly. For instance, I 'think' I am setting the blocked_range correctly, but I am probably wrong. I have the O'Reilly book, but there isn't a concise example of what I am attempting to do, which is to basically iterate the hash map and call a method on the type T.
typedef concurrent_hash_map CollectionOfFoos;
typedef concurrent_hash_map::const_iterator FoosIterator;
struct UpdateFoos
{
float DeltaT;
UpdateFoos(float elapsed_time) : DeltaT(elapsed_time) {};
void operator()(blocked_range& range) const
{
for (FoosIterator iter = range.begin(); iter != range.end(); ++iter)
{
iter->second->update(DeltaT);
}
}
};
CollectionOfFoos Foos;
...
// populate foos - not having problem with this.
...
void updateElapsedTime(float delta_t)
{
parallel_for(blocked_range(Foos.begin(), Foos.end(), 10000), UpdateFoos(delta_t));
}
Again, I 'think' I am doing this correctly, but considering the compiler error I am obviously not. I left out StringHashCompare, but it is basically the same as the examples except for the usemy data type.
I appreciate any help, thanks!
typedef concurrent_hash_map
typedef concurrent_hash_map
struct UpdateFoos
{
float DeltaT;
UpdateFoos(float elapsed_time) : DeltaT(elapsed_time) {};
void operator()(blocked_range
{
for (FoosIterator iter = range.begin(); iter != range.end(); ++iter)
{
iter->second->update(DeltaT);
}
}
};
CollectionOfFoos Foos;
...
// populate foos - not having problem with this.
...
void updateElapsedTime(float delta_t)
{
parallel_for(blocked_range
}
Again, I 'think' I am doing this correctly, but considering the compiler error I am obviously not. I left out StringHashCompare, but it is basically the same as the examples except for the usemy data type.
I appreciate any help, thanks!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - scasey67
I am a noobie concerning threading, so I thought that I would start with Threading Building Blocks for my application. I 'think' I am creating things appropriately, but I am getting compilier errors (on VS 2005 - Error C2784). I am able to create the map and populate it, but I don't think I am doing the parallel iteration correctly. For instance, I 'think' I am setting the blocked_range correctly, but I am probably wrong. I have the O'Reilly book, but there isn't a concise example of what I am attempting to do, which is to basically iterate the hash map and call a method on the type T.
typedef concurrent_hash_map CollectionOfFoos;
typedef concurrent_hash_map::const_iterator FoosIterator;
struct UpdateFoos
{
float DeltaT;
UpdateFoos(float elapsed_time) : DeltaT(elapsed_time) {};
void operator()(blocked_range& range) const
{
for (FoosIterator iter = range.begin(); iter != range.end(); ++iter)
{
iter->second->update(DeltaT);
}
}
};
CollectionOfFoos Foos;
...
// populate foos - not having problem with this.
...
void updateElapsedTime(float delta_t)
{
parallel_for(blocked_range(Foos.begin(), Foos.end(), 10000), UpdateFoos(delta_t));
}
Again, I 'think' I am doing this correctly, but considering the compiler error I am obviously not. I left out StringHashCompare, but it is basically the same as the examples except for the usemy data type.
I appreciate any help, thanks!
typedef concurrent_hash_map
typedef concurrent_hash_map
struct UpdateFoos
{
float DeltaT;
UpdateFoos(float elapsed_time) : DeltaT(elapsed_time) {};
void operator()(blocked_range
{
for (FoosIterator iter = range.begin(); iter != range.end(); ++iter)
{
iter->second->update(DeltaT);
}
}
};
CollectionOfFoos Foos;
...
// populate foos - not having problem with this.
...
void updateElapsedTime(float delta_t)
{
parallel_for(blocked_range
}
Again, I 'think' I am doing this correctly, but considering the compiler error I am obviously not. I left out StringHashCompare, but it is basically the same as the examples except for the usemy data type.
I appreciate any help, thanks!
After reading through a bunch of posts I had come across this:
http://software.intel.com/en-us/forums/showpost.php?p=51548
I had used the search function, but the thread abovedidn't come up for me.
Question answered.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page