Hi, This patch is an attempt to fix some potential race conditions with accesses to shared data structures from multiple concurrent threads in libgomp's OpenACC entry points. The main change is to move locking out of lookup_host and lookup_dev in oacc-mem.c and into their callers (which can then hold the locks for the whole operation that they are performing). Also missing locking has been added for gomp_acc_insert_pointer. Tests look OK (with offloading to NVidia PTX). OK? (For the gomp4 branch, maybe, if trunk's not suitable at the moment?) Thanks, Julian ChangeLog libgomp/ * oacc-mem.c (lookup_host): Remove locking from function. Note locking requirement for caller in function comment. (lookup_dev): Likewise. (acc_free, acc_deviceptr, acc_hostptr, acc_is_present) (acc_map_data, acc_unmap_data, present_create_copy, delete_copyout) (update_dev_host, gomp_acc_insert_pointer, gomp_acc_remove_pointer): Add locking.