Please find attached a patch to mark a shared buffer as read-write or
read-only using mprotect(). The idea is to catch violations of shared
buffer access rules. This patch was useful to detect the access
violations reported in this thread. The mprotect() calls are enabled
by -DMPROTECT_BUFFER compile time flag.
Asim