Make a 'lock'. When a thread beings to do something to the variable, 'lock' it. When it is finished, unlock it.
There. Now you can lock your thread with the number for the particular thread. When you're done, make an unlock function that sets the variable to -1.
long int threadLock;
long int bufferText( long int caller, char *text )
if( globalBuffer.threadLock != -1 )
globalBuffer.threadLock = caller;
memset( globalBuffer.buf, '\0', BUFSIZE );
strncpy( globalBuffer.buf, text, strlen( text ) );