Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Send for Transaction #26

Open
Laegluin opened this issue Jul 17, 2019 · 2 comments
Open

Implement Send for Transaction #26

Laegluin opened this issue Jul 17, 2019 · 2 comments

Comments

@Laegluin
Copy link
Contributor

I am not absolutely sure about this, but as far as I can tell a transaction is just a handle. Can a transaction be made Send just like RegKey?

@gentoo90
Copy link
Owner

Yes, looks like HANDLE should be thread safe
https://github.com/rust-lang/rust/blob/master/src/libstd/sys/windows/handle.rs
But anyway I'd want to test this kind of things before releasing it.
Do you have any particular use case?
Maybe a peace of code, which makes use of Sendable Transaction/RegKey?

@Laegluin
Copy link
Contributor Author

Laegluin commented Aug 2, 2019

I actually changed the code that required this and ended up not needing it anymore. In my case I was embedding a transaction as a value in gluon. Gluon can run on multiple threads so values you want to expose have to be Send. I'd imagine something like this (runtimes that require Send because they are multithreaded) would probably be the only real use case.

But anyway I'd want to test this kind of things before releasing it.

Yeah, I totally understand. I'm not quite sure how one would test this, though. I can only tell you that for the few times I used it it worked just fine, but that doesn't mean much of course. The windows docs aren't really clear on this unfortunately, in a lot of other places they explicitly state that a handle is thread-safe.

The best I could find is this paragraph:

Transactions are not the same as threads. Multiple threads or processes can be a part of a single transaction. Conversely, a thread can be a part of several different transactions at different times.

Which I guess implies that transaction handles are thread-safe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants