Mercurial > hg > fxanalyse
diff data-provider.h @ 98:99cbe2b57530
Allow up to 16 messages to pile up in the communication between threads
author | Daniele Nicolodi <daniele.nicolodi@obspm.fr> |
---|---|
date | Tue, 26 Mar 2013 18:20:12 +0100 |
parents | 4102fe614df2 |
children | 8b90fbba59ef |
line wrap: on
line diff
--- a/data-provider.h Tue Mar 26 18:18:38 2013 +0100 +++ b/data-provider.h Tue Mar 26 18:20:12 2013 +0100 @@ -18,14 +18,15 @@ double data[4]; }; -/* message */ -static char message[1024]; +/* message buffer */ +static char messages[256][16]; +static unsigned int messageid = 0; -#define SendMessage(threadId, ...) \ - do { \ - snprintf(message, sizeof(message) - 1, ##__VA_ARGS__); \ - PostDeferredCallToThread(MessageCB, message, threadId); \ +#define SendMessage(threadId, ...) \ + do { \ + char *message = messages[messageid++ % 16]; \ + snprintf(message, sizeof(message), ##__VA_ARGS__); \ + PostDeferredCallToThread(MessageCB, message, threadId); \ } while (0) - #endif