opencl: add support for non-pthread locking

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>