inline bool peek(value_type& ret_val) { bool success = false; lock.lock(); if(!_empty) { success = true; ret_val = value; } lock.unlock(); return success; } // end of peek
inline bool test_and_get(value_type& ret_val) { bool success = false; lock.lock(); if(!_empty) { success = true; ret_val = value; _empty = true; } lock.unlock(); return success; } // end of test_and_get
/** returns true if set for the first time */ inline bool set(const value_type& other, value_type& new_value, atomic<size_t>& joincounter) { bool first_set = false; lock.lock(); if(!_empty) value += other; else { value = other; first_set = true; } new_value = value; _empty = false; lock.unlock(); return first_set; }
/** Add an edge to the ingress object using oblivious greedy assignment. */ void add_edge(vertex_id_type source, vertex_id_type target, const EdgeData& edata) { obliv_lock.lock(); dht[source]; dht[target]; const procid_t owning_proc = base_type::edge_decision.edge_to_proc_greedy(source, target, dht[source], dht[target], proc_num_edges, usehash, userecent); obliv_lock.unlock(); typedef typename base_type::edge_buffer_record edge_buffer_record; edge_buffer_record record(source, target, edata); #ifdef _OPENMP base_type::edge_exchange.send(owning_proc, record, omp_get_thread_num()); #else base_type::edge_exchange.send(owning_proc, record); #endif } // end of add edge