carllerche / syncbox

Concurrency utilities for Rust
131 stars 14 forks source link

Standardize timeout parameter types on Duration #37

Open kamalmarhubi opened 8 years ago

kamalmarhubi commented 8 years ago

The LinkedQueue has offer_ms and poll_ms which both take a u32 of milliseconds, while the DelayQueue has a poll_timeout that takes a Duration. Since Duration is provided in the std, I think it's the right thing to standardize on.

laanwj commented 8 years ago

The non-duration wait_timeouts are deprecated in nightly, in combination with #![deny(warnings)] this causes the build to fail:

   Compiling syncbox v0.2.4 (file:///home/user/projects/syncbox)
src/delay_queue.rs:99:40: 99:71 error: use of deprecated item: replaced by `std::sync::Condvar::wait_timeout`, #[deny(deprecated)] on by default
src/delay_queue.rs:99             queue = self.inner.condvar.wait_timeout_ms(queue, timeout).unwrap().0;
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/delay_queue.rs:194:40: 194:71 error: use of deprecated item: replaced by `std::sync::Condvar::wait_timeout`, #[deny(deprecated)] on by default
src/delay_queue.rs:194                     self.inner.condvar.wait_timeout_ms(queue, timeout).unwrap().0
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/linked_queue.rs:209:38: 209:64 error: use of deprecated item: replaced by `std::sync::Condvar::wait_timeout`, #[deny(deprecated)] on by default
src/linked_queue.rs:209                 last = self.not_full.wait_timeout_ms(last, dur)
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/linked_queue.rs:272:39: 272:65 error: use of deprecated item: replaced by `std::sync::Condvar::wait_timeout`, #[deny(deprecated)] on by default
src/linked_queue.rs:272                 head = self.not_empty.wait_timeout_ms(head, dur)
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to 4 previous errors
Could not compile `syncbox`.

To learn more, run the command again with --verbose.