Closed theduke closed 4 years ago
Can you post your full source code? Without details, it's hard to see what's the actual problem is.
Well just looking it at the code makes it obvious: a File
can't receive consecutive writes from different threads, since begin_write()
initializes a thread local TXID
, which will not be set on a second write from a different thread.
So with the current design, File
should really be !Send
.
Your looking is right. When shared with multiple threads, File
works like a reader-writer lock, that is, you can only have one thread to modify it, but you can have multiple threads to read. So I think !Send
is still valid.
It seems like writing to a file repeatedly from multiple threads is not possible and is terminated with a
NotInTrans
error.I stumbled over this while trying to do so from a
async fn
.