servo / gecko-media

Firefox's media playback stack in a stand alone Rust crate
Mozilla Public License 2.0
6 stars 9 forks source link

Add Send + Sync bounds to 2 traits #114

Closed nox closed 6 years ago

nox commented 6 years ago

@cpearce r?

cpearce commented 6 years ago

@nox: Gecko may call the NetworkResource functions from a number of different threads, so on the face of it, this seems reasonable, but is it really necessary? How does this contribute to make NetworkResource impls thread safe? Is mpsc::Sender<> not internally threadsafe? Given that it's used to send messages between threads, I'd have assumed it internally took a lock when it accessed the message queue on its matching Receiver.

nox commented 6 years ago

Sender<T> isn't Sync, that's why the mutex is needed.

cpearce commented 6 years ago

Ah, so Sender isn't Sync itself, so we need the Mutex to make it Sync, to protect its other state I suppose.

cpearce commented 6 years ago

@bors-servo r=cpearce

bors-servo commented 6 years ago

:pushpin: Commit 36de5a5 has been approved by cpearce

bors-servo commented 6 years ago

:hourglass: Testing commit 36de5a527ac02886cb9ddfdd98c1def9b6a373c2 with merge 1e3fbf22c5f4a893f3d7387fcd8a076d5ac13ef6...

bors-servo commented 6 years ago

:broken_heart: Test failed - status-travis

bors-servo commented 6 years ago

:sunny: Test successful - status-travis Approved by: cpearce Pushing 1e3fbf22c5f4a893f3d7387fcd8a076d5ac13ef6 to master...