Mercurial > hg > fxanalyse
annotate data-provider.c @ 261:a03df7dc98f8
Add xsocket wrappers
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 16 Jun 2015 15:09:23 +0200 |
parents | ec81395bf08d |
children |
rev | line source |
---|---|
144 | 1 #include <ansi_c.h> |
2 #include <userint.h> | |
3 | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
4 #include "logging.h" |
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
5 |
144 | 6 /* message buffer */ |
7 #define DATA_PROVIDER_MSGLEN 256 | |
8 #define DATA_PROVIDER_MSGNUM 16 | |
9 static char messages[DATA_PROVIDER_MSGLEN][DATA_PROVIDER_MSGNUM]; | |
10 static unsigned int messageid = 0; | |
11 | |
12 | |
13 /* message callback */ | |
239
ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
169
diff
changeset
|
14 static void CVICALLBACK send_message_callback(void *msg) |
144 | 15 { |
16 if (msg != NULL) | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
17 logmessage(INFO, msg); |
144 | 18 } |
19 | |
169
97112b45b838
Get Sr data logger parameters from configuration file. Code reorganization.
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
144
diff
changeset
|
20 |
239
ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
169
diff
changeset
|
21 void send_message(int thread, const char *frmt, ...) |
144 | 22 { |
23 /* message buffer */ | |
24 char *message = messages[messageid++ % DATA_PROVIDER_MSGNUM]; | |
25 | |
26 /* format message */ | |
27 va_list args; | |
28 va_start(args, frmt); | |
29 vsnprintf(message, DATA_PROVIDER_MSGLEN - 1, frmt, args); | |
30 va_end(args); | |
31 | |
32 /* signal main thread */ | |
239
ec81395bf08d
Solve name collisions and other problems caused by including Windows headers
Daniele Nicolodi <daniele.nicolodi@obspm.fr>
parents:
169
diff
changeset
|
33 PostDeferredCallToThread(send_message_callback, message, thread); |
144 | 34 } |
35 |