Revision 9 logic/trunk/src/startup/main.c

View differences:

main.c
1

  
1
/*
2
 * main.c
3
 *
4
 * 2011, Aleksander Besir (alex.besir@gmail.com)
5
 *
6
 */
7
 
2 8
#include "../hci_comm/hci_comm.h"
9
#include <stdio.h>
10
#include <pthread.h>
3 11

  
12
// Inter-thread shared variables
13
// TODO: These variables could be configuration variables
14
//       (eg: static boolean loggingEnabled)
15

  
16
// Crtitical section mutual exclusion security
17
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
18

  
19
// Application entry point
4 20
int main(int argc, char *argv[]) {
5 21

  
6
	listenTo(1100);
7
	return 0;
22
	pthread_t hciConnectionThread;
23
	pthread_t decisionMakingThread;
24
	
25
	pthread_create(&hciConnectionThread,NULL,hciConnectionThread_routine,NULL);
26
	pthread_create(&decisionMakingThread,NULL,decisionMakingThread_routine,NULL);
27
	
28
	pthread_join(hciConnectionThread,NULL);
29
	pthread_join(decisionMakingThread,NULL);
30
	
31
	exit(0);
8 32

  
9 33
}
34

  
35
// Decision-making thread routine
36
// Should just call a function that implements decision making module of the logic
37
void *decisionMakingThread_routine(void *dummy) {
38
	
39
	// TODO: Implemet decision making
40
	
41
	pthread_exit(0);
42
	
43
}
44

  
45
// HCI connection thread routine
46
// Start listening to some port
47
void *hciConnectionThread_routine(void *dummy) {
48

  
49
	int hciErrorCode = listenTo(1100);
50
	
51
	pthread_exit(0);
52

  
53
}

Also available in: Unified diff