Ejemplo n.º 1
0
int main(int argc, char** argv)
{
        cout << "boost::lockfree::queue is ";
	if (!spsc_queue.is_lock_free())
		cout << "not ";
	cout << "lockfree" << endl;
	vector<float> detector = load_lear_model(argv[1]); /* load model */
	hog.setSVMDetector(detector);

	cap.open("d://1.avi");
	//cap.open("http://10.104.5.192:8888/?action=stream?dummy=param.mjpg");//get image by mjpeg stream
	cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);
	cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);
	if (!cap.isOpened())
		return -1;

	thread mThread( producer );
	Sleep(5000);                                /* 让生产者先生产一会儿 */

	thread mThread2( consumer );
	mThread.join();
	mThread2.join();

	return 0;
}
Ejemplo n.º 2
0
int main(int argc, char* argv[])
{
    using namespace std;
    cout << "boost::lockfree::queue is ";
    if (!spsc_queue.is_lock_free())
        cout << "not ";
    cout << "lockfree" << endl;

    boost::thread producer_thread(producer);
    boost::thread consumer_thread(consumer);

    producer_thread.join();
    done = true;
    consumer_thread.join();

    cout << "produced " << producer_count << " objects." << endl;
    cout << "consumed " << consumer_count << " objects." << endl;
}