ssmp is a highly optimized message passing library built on top of the cache-coherence protocols of shared memory processors. It exports functions for sending and receiving cache-line-sized (or bigger) messages.
ssmp uses cache-line-sized buffers to efficiently exchange messages between cores. Ideally, a message transfer is as expensive as a single cache-line transfer. To achieve this ssmp collocates the flags used to synchronize message exchanges with the actual data.
You can get a copy of the source code of ssmp at: https://github.com/trigonak/ssmp