There are some considerations to be taken when using synchronous variables.
Every time you call DICE_sync, you should update your variables with DICE_sync_update. That is because, if some variable value changed, the variable itself was freed and reallocated, so your pointers are likely to be outdated. The reason for this apparently stupid behavior is that some types have variable sizes (such as strings), so sometimes the pointer would have to be updated. To avoid clumsiness (this type needs to be updated, this one doesn't), it was decided to make this a standard. Future versions may improve this internally, avoiding the reallocation iff explicitly declared. You can solve this problem easily, and avoid any kind of trouble, declaring your own sync function, and letting it take care of updates, like in this example:
int my_sync ( void ) {
DICE_sync_update("foo", f);
i = DICE_sync();
if (i)
You also have to take care in threaded programs, but you always have to take care when you write a threaded program anyway. I believe that you just need to pay attention to two things:
This function [read(2)] is a cancelation point in multi-threaded programs. This is a problem if the thread allocates some resources (like memory, file descriptors, semaphores or whatever) at the time `read' is called. If the thread gets canceled these resources stay allocated until the program ends. To avoid this calls to `read' should be protected using cancelation handlers.So that's another reason to have a my_sync function.
Threaded programs may also have problems with asynchronous functions, so be sure to read section 4 too.