|
1 /***************************************************************************** |
|
2 * Copyright (C) 2008-2014 |
|
3 * |
|
4 * Michiel Broek <mbroek at mbse dot eu> |
|
5 * |
|
6 * This file is part of the mbsePi-apps |
|
7 * |
|
8 * This is free software; you can redistribute it and/or modify it |
|
9 * under the terms of the GNU General Public License as published by the |
|
10 * Free Software Foundation; either version 2, or (at your option) any |
|
11 * later version. |
|
12 * |
|
13 * mbsePi-apps is distributed in the hope that it will be useful, but |
|
14 * WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 * General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU General Public License |
|
19 * along with ThermFerm; see the file COPYING. If not, write to the Free |
|
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
21 *****************************************************************************/ |
|
22 |
|
23 #include "thermferm.h" |
|
24 #include "simulator.h" |
|
25 |
|
26 #ifdef USE_SIMULATOR |
|
27 |
|
28 extern int my_shutdown; |
|
29 extern int debug; |
|
30 |
|
31 |
|
32 |
|
33 #ifdef HAVE_WIRINGPI_H |
|
34 PI_THREAD (my_simulator_loop) |
|
35 #else |
|
36 void *my_simulator_loop(void *threadid) |
|
37 #endif |
|
38 { |
|
39 |
|
40 syslog(LOG_NOTICE, "Thread my_simulator_loop started"); |
|
41 if (debug) |
|
42 fprintf(stdout, "Thread my_simulator_loop started\n"); |
|
43 |
|
44 for (;;) { |
|
45 |
|
46 if (my_shutdown) |
|
47 break; |
|
48 |
|
49 usleep(100000); |
|
50 } |
|
51 |
|
52 syslog(LOG_NOTICE, "Thread my_simulator_loop stopped"); |
|
53 if (debug) |
|
54 fprintf(stdout, "Thread my_simulator_loop stopped\n"); |
|
55 return 0; |
|
56 } |
|
57 |
|
58 |
|
59 #endif |