The 'classic' way of performing such inter-thread comms is to malloc the receiveBuf, queue off the buffer pointer after receipt of data and immediately malloc another receive buffer for the next load of data. You can free the buffer pointers after handling them in the GUI.
Such an approach means that the UI and network threads never operate on the same buffer and so can operate independently.