Collaboration between host and devices

I want to implement a program in which CPU(as the host) and GPU can work together. Because CPU and GPU need to communicate with each other by a flag structure, my question is: if I allocate a buffer (buf, for example) which stores the flag structure, naturally, it can be accessed and modified by GPU directly at any time, then I use clEnqueueMapBuffer to map buf to a pointer in CPU memory space (ptr, for example) , then can CPU know any changes made by GPU to buf? Vice verse, if CPU will also make changes to ptr frequently, can these changes be seen by GPU instantly?

NO reply? Really strange…

No, cpu and gpu cant concurrently have a watch on that buffers. you will have to unmap the buffer before the gpu is allowed to acces it. read he mapping chapte of the spec to make shure what is allowed and what is “undefined”. It could be, that reading might be okay in some cases