示例#1
0
/*
 * Returns the value of pthread_create(3).
 */
int
create_ihandler_thread(struct inotify_event *event)
{
	int err;
	pthread_t handler;

	err = create_detached_thread(&handler, ihandler_thread, event);
	if (err < 0)
		err_create_detached_thread(errno);

	return err;
}
示例#2
0
int main(int argc, char** argv)
{
	needshowstackbackwhencrack();

	//nvr_test();

	//testloop(NULL);
#if 1	

	for(int i=0; i<50; ++i)
	{
		printf("while(i++) %d\n", i);	
		pthread_t tid;
		//test_all(&_setinfo[i]);
		create_detached_thread(&tid, test_all, &_setinfo[i]);
	}

	//getchar();
	sleep(1000000);

#if 0
	int i=100;
	while(i--)
	{
		pthread_t tid;
		create_detached_thread(&tid, test_all, NULL);
	}


	
	sleep(10000);
#endif

#endif

#if 0	
	int i=20;
	while(i--)
	{
	
	nmc_init(static_NmcStatusCallback, 0);

	//getchar();
	//nmc_search_device(NULL, NULL);
	int i = 0;
	//while(1)

	bool sw = true;


		time_t t0 = time(0);
	
		struct login_info info;
		memset(&info, 0, sizeof(info));
		strcpy(info.ip, "192.168.3.86");
		info.port = 40000;
		strcpy(info.user, "admin");
		strcpy(info.password, "admin");

		long m_handle = nmc_login(&info);
		if(m_handle==-1L)
		{
			printf("nmc_login failed!\n");
			return -1;
		}

		printf("nmc_login ok!\n");	

		//getchar();
		
		get_get_matrix(m_handle);

		//getchar();
		
		get_output(m_handle);

		//getchar();
		
		get_source(m_handle);

		//getchar();
		
		get_remote_source(m_handle);

		//getchar();
		
		get_sw_info(m_handle);

		//getchar();
		

		time_t t1 = time(0);
		
		int res;
		if(sw)
		{
			res = nmc_set_window_signal_source(m_handle, 0, 385, 1, 33718);
		}
		else
		{
			res = nmc_set_window_signal_source(m_handle, 0, 385, 1, 33719);
		}
		sw = !sw;
		if(res)
		{
			printf("nmc_rmv_signal_source failed!\n"); 
		}
		time_t t2 = time(0);
		
		//sleep(1);

		time_t t3 = time(0);
		res = nmc_clear_window_signal_source(m_handle, 0, 1, 385);
		if(res)
		{

		}
		time_t t4 = time(0);
		printf("prepare cost %ld\n", t1-t0);	
		printf("nmc_set_window_signal_source cost %ld\n", t2-t1);	
		printf("nmc_clear_window_signal_source cost %ld\n", t3-t4);	

		res;
		if(sw)
		{
			tcpstream_test(m_handle, "192.168.3.65", 37777, "admin", "admin", "DH");
		}
		else
		{
			tcpstream_test(m_handle, "192.168.3.29", 80, "admin", "admin", "ONVIF");
		}

		sw = !sw;

		//添加一个TCP信号源并在窗口显示
		//tcpstream_test(m_handle, "192.168.3.45", 15479);

		printf("nmc_logout before!\n");	

		nmc_logout(m_handle);
		//break;
	

		//getchar();
	
		printf("nmc_uninit 111!\n");	

		//nmc_uninit((void*)1);
		nmc_uninit(NULL);
	}
#endif
	
	printf("nmc_uninit 222!\n");	
	
	return 0;
}