I am working on windows and I want to know which one is right?
1)A event callback is executed as a new thread in the host.
2)A event callback is executed as part of the main thread in the host.
And I also want to know if 2) is right, where the callback is pluged into the main thread?
Sorry for my ignorance.
I don’t think the spec requires one behavior or the other. In practice, I think I’ve usually seen the event callback executing on a separate thread. Hope this helps!
Expect it to be from non-main-thread. Or, to think of it another way, driver actually has no way to call you from main thread, if you never call it from main thread.
Thank you bashbaug and Dithermaster
What you said are reasonable, even I wish it is not true.
So I have to lock the variables that the callbacks change, that’s a matter I would like to avoid.
Anyway thanks a lot!