OpenCL, Pinned Memory and Pthreads hanging

I have a simple program that is just timing bandwidth (moving data over to the GPU), using pinned memory. It is basically using exactly the code from the NVIDIA OpenCL programming guide.

The code is happening in a single thread (I’m only running one thread for now) using pthreads. Later I was planning on using another thread to send data to another GPU.

Currently it hangs at the last line of the thread function, pthread_exit(NULL).

If I do not use pinned memory, and transfer data the same way, the thread exits normally…

Any ideas?
Thanks