cudaThreadSynchronize() in MultyThreade Application

Hello everyone,
I’m trying to use CDUA Streams in Multy Threaded windows application.

And I have the following problem , I can’t call cudaThreadSynchronize()
in thread that not created it , I get invalid handler error.

I checked with debugger and both threads run function on same object, so I don’t think it’s my programing error

also Windows mutexes work fine.
Anyone know how to fix it ?

Thanks in advance,
Victor

Anyone ?

It is a documented limitation that CUDA functions must be called in the same host thread that created the CUDA context. The driver API allows you to migrate a CUDA context to a different thread, but it has some overhead.

The best fix is to use one host thread for all CUDA calls.

OK, Thanks for your help