Closed rbtying closed 5 years ago
Thanks! Would you like to prepare a PR?
Issue #18 is also about RuntimeContext
, maybe you have some ideas there as well?
Yup, I'll send something over when I get a chance -- ran across this while looking at the landscape for COM things in Rust, and haven't finished setting everything up yet (CoInitialize has the same issue, haha).
c.f. #18, I think that will require more reading / playing with types to get right. Worth doing, but needs more thought.
RuntimeContext
is a wrapper aroundRoInitialize
andRoUninitialize
, which initialize (and uninitialize) the WinRT runtime per thread.Calling
RoUninitialize
from a different thread thanRoInitialize
is not allowed.To fix this, we can replace the inner
()
withPhantomData<*mut ()>
, which is also a zero-size type and (by virtue of containing a pointer) is not automaticallySend
andSync
. In the future (i.e. when more stuff is stablized), we can explicitly doimpl !Send for RuntimeContext
.