int main(int argc, char* argv[]) {
/*    int write_buf;
    char read_buf;*/

	// Initialization
    initDevices();
    #ifndef WITHOUT_NETWORK
//	initPeerSocket();
	#endif

	usleep(3000000); // delay 3sec

	#ifdef SERVERMODE
	#ifndef WITHOUT_NETWORK
	// Wait for arrival
	
	sendStopSignal();
	#endif
	#endif

	// Strart linetracing
	int thr_id[4];
	pthread_t p_threads[4];

	thr_id[3] = pthread_create(&p_threads[3], NULL, videoFrame, (void *)NULL);     
	if (thr_id[3] < 0)     
	{    
		perror("thread1 create error : ");  
		exit(0);    
	}
	
	confirm_Response();
	
	usleep(1000000);
	
	waitThreeAxisChange();	
	
	thr_id[0] = pthread_create(&p_threads[0], NULL, traceLine, (void *)NULL);     
	if (thr_id[0] < 0)     
	{    
		perror("thread1 create error : ");  
		exit(0);    
	}

	thr_id[1] = pthread_create(&p_threads[1], NULL, writeCommand, (void *)NULL);     
	if (thr_id[1] < 0) {    
		perror("command thread create error : ");  
		exit(0);    
	}
    
	
/*	
	#ifdef CLIENTMODE
	#ifndef WITHOUT_NETWORK
	thr_id[2] = pthread_create(&p_threads[2], NULL, recieveStopSignal, (void *)NULL);     
	if (thr_id[2] < 0) {    
		perror("command thread create error : ");  
		exit(0);    
	}
	
	
	#endif
	#endif
*/  
	int status;
	#ifdef CLIENTMODE
//	pthread_join(p_threads[2], (void **)&status);
	#endif
	pthread_join(p_threads[0], (void **)&status);


	pthread_join(p_threads[1], (void **)&status);
	pthread_join(p_threads[3], (void **)&status);
	
	endProgram();

	return 0;
}  
Beispiel #2
0
void Inotify::stop()
{
    mStopped = true;
    sendStopSignal();
}