|
10 | 10 | #include <stdexcept> |
11 | 11 | #include <utility> |
12 | 12 |
|
13 | | -#if BOOST_VERSION < 105300 |
14 | | -#else |
| 13 | +#ifdef HAVE_LOCKFREE |
15 | 14 | #include <boost/atomic.hpp> |
16 | 15 | #endif |
17 | 16 |
|
@@ -167,7 +166,7 @@ struct pending_threaded_processor : public middle_t::pending_processor { |
167 | 166 | typedef std::vector<boost::shared_ptr<output_t> > output_vec_t; |
168 | 167 | typedef std::pair<boost::shared_ptr<const middle_query_t>, output_vec_t> clone_t; |
169 | 168 |
|
170 | | -#if BOOST_VERSION < 105300 |
| 169 | +#ifndef HAVE_LOCKFREE |
171 | 170 | static void do_jobs(output_vec_t const& outputs, pending_queue_t& queue, size_t& ids_done, boost::mutex& mutex, int append, bool ways) { |
172 | 171 | while (true) { |
173 | 172 | //get the job off the queue synchronously |
@@ -209,7 +208,7 @@ struct pending_threaded_processor : public middle_t::pending_processor { |
209 | 208 |
|
210 | 209 | //starts up count threads and works on the queue |
211 | 210 | pending_threaded_processor(boost::shared_ptr<middle_query_t> mid, const output_vec_t& outs, size_t thread_count, size_t job_count, int append) |
212 | | -#if BOOST_VERSION < 105300 |
| 211 | +#ifndef HAVE_LOCKFREE |
213 | 212 | //note that we cant hint to the stack how large it should be ahead of time |
214 | 213 | //we could use a different datastructure like a deque or vector but then |
215 | 214 | //the outputs the enqueue jobs would need the version check for the push(_back) method |
@@ -256,7 +255,7 @@ struct pending_threaded_processor : public middle_t::pending_processor { |
256 | 255 |
|
257 | 256 | //make the threads and start them |
258 | 257 | for (size_t i = 0; i < clones.size(); ++i) { |
259 | | -#if BOOST_VERSION < 105300 |
| 258 | +#ifndef HAVE_LOCKFREE |
260 | 259 | workers.create_thread(boost::bind(do_jobs, boost::cref(clones[i].second), boost::ref(queue), boost::ref(ids_done), boost::ref(mutex), append, true)); |
261 | 260 | #else |
262 | 261 | workers.create_thread(boost::bind(do_jobs, boost::cref(clones[i].second), boost::ref(queue), boost::ref(ids_done), append, true)); |
@@ -307,7 +306,7 @@ struct pending_threaded_processor : public middle_t::pending_processor { |
307 | 306 |
|
308 | 307 | //make the threads and start them |
309 | 308 | for (size_t i = 0; i < clones.size(); ++i) { |
310 | | -#if BOOST_VERSION < 105300 |
| 309 | +#ifndef HAVE_LOCKFREE |
311 | 310 | workers.create_thread(boost::bind(do_jobs, boost::cref(clones[i].second), boost::ref(queue), boost::ref(ids_done), boost::ref(mutex), append, false)); |
312 | 311 | #else |
313 | 312 | workers.create_thread(boost::bind(do_jobs, boost::cref(clones[i].second), boost::ref(queue), boost::ref(ids_done), append, false)); |
@@ -353,7 +352,7 @@ struct pending_threaded_processor : public middle_t::pending_processor { |
353 | 352 | //job queue |
354 | 353 | pending_queue_t queue; |
355 | 354 |
|
356 | | -#if BOOST_VERSION < 105300 |
| 355 | +#ifndef HAVE_LOCKFREE |
357 | 356 | //how many ids within the job have been processed |
358 | 357 | size_t ids_done; |
359 | 358 | //so the threads can manage some of the shared state |
|
0 commit comments