summaryrefslogtreecommitdiff
path: root/src/main/portfolio.cpp
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@cs.nyu.edu>2013-11-12 18:13:17 -0500
committerMorgan Deters <mdeters@cs.nyu.edu>2013-11-12 18:13:17 -0500
commitc8e1acb9d8280ee61919d192d61881348bc36f91 (patch)
tree9789cdf340304a000441fefd72cb4e3ab4e3833e /src/main/portfolio.cpp
parent362114a95855497568694c59cb0f5a72d2c30d29 (diff)
Minor portfolio fixes for some platforms.
Diffstat (limited to 'src/main/portfolio.cpp')
-rw-r--r--src/main/portfolio.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/portfolio.cpp b/src/main/portfolio.cpp
index cf8bba1ba..56a05795a 100644
--- a/src/main/portfolio.cpp
+++ b/src/main/portfolio.cpp
@@ -62,8 +62,8 @@ std::pair<int, S> runPortfolio(int numThreads,
boost::function<S()> threadFns[],
bool optionWaitToJoin) {
boost::thread thread_driver;
- boost::thread threads[numThreads];
- S threads_returnValue[numThreads];
+ boost::thread* threads = new boost::thread[numThreads];
+ S* threads_returnValue = new S[numThreads];
global_flag_done = false;
global_winner = -1;
@@ -78,8 +78,9 @@ std::pair<int, S> runPortfolio(int numThreads,
thread_driver = boost::thread(driverFn);
boost::unique_lock<boost::mutex> lock(mutex_main_wait);
- while(global_flag_done == false)
+ while(global_flag_done == false) {
condition_var_main_wait.wait(lock);
+ }
if(not driverFn.empty()) {
thread_driver.interrupt();
@@ -92,7 +93,12 @@ std::pair<int, S> runPortfolio(int numThreads,
}
}
- return std::pair<int, S>(global_winner,threads_returnValue[global_winner]);
+ std::pair<int, S> retval(global_winner, threads_returnValue[global_winner]);
+
+ delete[] threads;
+ delete[] threads_returnValue;
+
+ return retval;
}
// instantiation
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback