Example #1
0
    void add(void)
    {
        for (boost::uint32_t i = 0; i != nodes_per_thread; ++i) {
            int id = generate_id<int>();
            working_set.insert(id);

            while (sf.push(id) == false)
            {}

            ++spsc_queue_cnt;
        }
        running = false;
    }
Example #2
0
    void add(void)
    {
        boost::array<int, buf_size> input_buffer;
        for (boost::uint32_t i = 0; i != nodes_per_thread; i+=buf_size) {
            for (size_t i = 0; i != buf_size; ++i) {
                int id = generate_id<int>();
                working_set.insert(id);
                input_buffer[i] = id;
            }

            size_t pushed = 0;

            do {
                pushed += sf.push(input_buffer.c_array() + pushed,
                                  input_buffer.size()    - pushed);
            } while (pushed != buf_size);

            spsc_queue_cnt+=buf_size;
        }
    }
Example #3
0
 inline void yield(vector<double> &s){ data_queue.push(s); };