Revision 57 logic/trunk/src/startup/main.c
main.c | ||
---|---|---|
13 | 13 |
#include <stdio.h> |
14 | 14 |
#include <pthread.h> |
15 | 15 |
#include <syslog.h> |
16 |
#include "../hci_comm/hciChanged.h" |
|
16 | 17 |
|
17 | 18 |
// Inter-thread shared variables |
18 | 19 |
// TODO: These variables could be configuration variables |
... | ... | |
23 | 24 |
//extern scenario *test; //device list |
24 | 25 |
|
25 | 26 |
// Crtitical section mutual exclusion security |
26 |
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
|
|
27 |
pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; |
|
27 | 28 |
|
29 |
// Global variable to check, if HCI made any changes that need |
|
30 |
// to be updated by the logic. |
|
31 |
// Changing this variable's value must be done using the |
|
32 |
// mutex mtx declared before. |
|
33 |
// To change variables value you should do this: |
|
34 |
// pthread_mutex_lock(&mtx); |
|
35 |
// hciChanged = 0; |
|
36 |
// pthread_mutex_unlock(&mtx); |
|
37 |
// The meaning of hciChanged possible values is in hci_comm/hciChanged.h. |
|
38 |
// HCI should always reset hciChanged value to HCI_CHANGED_RESET after |
|
39 |
// checking it's value. |
|
40 |
// To use mtx and hciChanged variables in other .c files, write |
|
41 |
// extern int hciChanged; |
|
42 |
// extern pthread_mutex_t mtx; |
|
43 |
// on top of the class. |
|
44 |
|
|
45 |
int hciChanged = HCI_CHANGED_RESET; |
|
46 |
|
|
28 | 47 |
void *decisionMakingThread_routine(void *dummy); |
29 | 48 |
void *hciConnectionThread_routine(void *dummy); |
30 | 49 |
void *randomValThread_routine(void *dummy); |
Also available in: Unified diff