예제 #1
0
void producer(void)
{
    for (int i = 0; i != iterations; ++i) {
        int value = ++producer_count;
        while (!spsc_queue.push(value))
            ;
    }
}
예제 #2
0
/* 
 * ===  FUNCTION  ======================================================================
 *         Name:  producer
 *  Description:  简单的获取图像
 * =====================================================================================
 */
void producer(void)
{
	while (true)
	{
		cap.read(img);                          /* 获取图像 */
		spsc_queue.push(img);                   /* 加入到缓存队列中 */

	}
}
예제 #3
0
void rng_producer(void)
{
    float *arr = new float[RNG_ARRAY_SIZE];
    int produced, producer_count;

	while (!rng_producer_done)
	{
        producer_count = 0;

        /* Generate n floats on device */
        curandGenerateNormal(gen, devData, RNG_ARRAY_SIZE, 0.0, 1.0);
        /* Copy device memory to host */
        cudaMemcpy(arr, devData, RNG_ARRAY_SIZE * sizeof(float), cudaMemcpyDeviceToHost);
        
        while (producer_count < RNG_ARRAY_SIZE && !rng_producer_done)
            while ( produced = spsc_queue.push(&arr[producer_count], RNG_ARRAY_SIZE -producer_count) )
                producer_count = producer_count + produced; 
	}
    delete(arr);
}
예제 #4
0
	inline bool Queue(ISqlStmt_t query)
	{
		return m_Queue.push(query) && ++m_UnprocessedQueries;
	}
예제 #5
0
	inline void Call(Callback_t callback)
	{
		m_Queue.push(callback);
	}