| 25 | } |
| 26 | |
| 27 | int ThreadQueues::distribute_with_sync(ThreadJob job, int n_items) |
| 28 | { |
| 29 | if (find_available() == 0) |
| 30 | return 0; |
| 31 | |
| 32 | auto res = get_n_per_thread(n_items) * get_n_threads(n_items); |
| 33 | auto n_threads = get_n_threads(n_items) + (res != n_items); |
| 34 | if (OnlineOptions::singleton.has_option("debug_sync")) |
| 35 | cerr << "sync " << n_threads << ", res " << res << "/" << n_items |
| 36 | << endl; |
| 37 | if (n_threads > 1) |
| 38 | { |
| 39 | assert(not sync_point); |
| 40 | sync_point = new barrier(n_threads); |
| 41 | } |
| 42 | return distribute_no_setup(job, n_items); |
| 43 | } |
| 44 | |
| 45 | int ThreadQueues::find_available() |
| 46 | { |
no test coverage detected