# HG changeset patch # User Daniele Nicolodi # Date 1364318412 -3600 # Node ID 99cbe2b575308a3de6bca9c911ea1840eb7ce9bb # Parent 675cb8d5e8a762e53f6f319c05a4bb3d612dbcf6 Allow up to 16 messages to pile up in the communication between threads diff -r 675cb8d5e8a7 -r 99cbe2b57530 data-provider.h --- 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