Mercurial > hg > fxanalyse
changeset 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 | 675cb8d5e8a7 |
children | dad4414051c4 |
files | data-provider.h |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
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