Commit to the API and long-term support.
- sync: spurious wakeup in
watch
(#3234).
- io: rename
AsyncFd::with_io()
totry_io()
(#3306) - fs: avoid OS specific
*Ext
traits in favor of conditionally defining the fn (#3264). - fs:
Sleep
is!Unpin
(#3278). - net: pass
SocketAddr
by value (#3125). - net:
TcpStream::poll_peek
takesReadBuf
(#3259). - rt: rename
runtime::Builder::max_threads()
tomax_blocking_threads()
(#3287). - time: require
current_thread
runtime when callingtime::pause()
(#3289).
- remove
tokio::prelude
(#3299). - io: remove
AsyncFd::with_poll()
(#3306). - net: remove
{Tcp,Unix}Stream::shutdown()
in favor ofAsyncWrite::shutdown()
(#3298). - stream: move all stream utilities to
tokio-stream
untilStream
is added tostd
(#3277). - sync: mpsc
try_recv()
due to unexpected behavior (#3263). - tracing: make unstable as
tracing-core
is not 1.0 yet (#3266).
- fs:
poll_*
fns toDirEntry
(#3308). - io:
poll_*
fns toio::Lines
,io::Split
(#3308). - io:
_mut
method variants toAsyncFd
(#3304). - net:
poll_*
fns toUnixDatagram
(#3223). - net:
UnixStream
readiness and non-blocking ops (#3246). - sync:
UnboundedReceiver::blocking_recv()
(#3262). - sync:
watch::Sender::borrow()
(#3269). - sync:
Semaphore::close()
(#3065). - sync:
poll_*
fns tompsc::Receiver
,mpsc::UnboundedReceiver
(#3308). - time:
poll)*
fns totime::Interval
(#3316).
- rt: fix deadlock in shutdown (#3228)
- rt: fix panic in task abort when off rt (#3159)
- sync: make
add_permits
panic with usize::MAX >> 3 permits (#3188) - time: Fix race condition in timer drop (#3229)
- watch: fix spurious wakeup (#3244)
- example: add back udp-codec example (#3205)
- net: add
TcpStream::into_std
(#3189)
- rt: fix
shutdown_timeout(0)
(#3196). - time: fixed race condition with small sleeps (#3069).
- io:
AsyncFd::with_interest()
(#3167). - signal:
CtrlC
stream on windows (#3186).
- stream:
StreamMap
Default
impl bound (#3093). - io:
AsyncFd::into_inner()
should deregister the FD (#3104).
- meta:
parking_lot
feature enabled withfull
(#3119).
- io:
AsyncWrite
vectored writes (#3149). - net: TCP/UDP readiness and non-blocking ops (#3130, #2743, #3138).
- net: TCP socket option (linger, send/recv buf size) (#3145, #3143).
- net: PID field in
UCred
with solaris/illumos (#3085). - rt:
runtime::Handle
allows spawning onto a runtime (#3079). - sync:
Notify::notify_waiters()
(#3098). - sync:
acquire_many()
,try_acquire_many()
toSemaphore
(#3067).
Fixes a soundness hole by adding a missing Send
bound to
Runtime::spawn_blocking()
.
- rt: include missing
Send
, fixing soundness hole (#3089). - tracing: avoid huge trace span names (#3074).
- net:
TcpSocket::reuseport()
,TcpSocket::set_reuseport()
(#3083). - net:
TcpSocket::reuseaddr()
(#3093). - net:
TcpSocket::local_addr()
(#3093). - net: add pid to
UCred
(#2633).
Adds AsyncFd
as a replacement for v0.2's PollEvented
.
- io: fix a potential deadlock when shutting down the I/O driver (#2903).
- sync:
RwLockWriteGuard::downgrade()
bug (#2957).
- io:
AsyncFd
for receiving readiness events on raw FDs (#2903). - net:
poll_*
function onUdpSocket
(#2981). - net:
UdpSocket::take_error()
(#3051). - sync:
oneshot::Sender::poll_closed()
(#3032).
This release fixes an use-after-free in the IO driver. Additionally, the read_buf
and write_buf
methods have been added back to the IO traits, as the bytes crate
is now on track to reach version 1.0 together with Tokio.
- net: fix use-after-free (#3019).
- fs: ensure buffered data is written on shutdown (#3009).
- io:
copy_buf()
(#2884). - io:
AsyncReadExt::read_buf()
,AsyncReadExt::write_buf()
for working withBuf
/BufMut
(#3003). - rt:
Runtime::spawn_blocking()
(#2980). - sync:
watch::Sender::is_closed()
(#2991).
This represents a 1.0 beta release. APIs are polished and future-proofed. APIs not included for 1.0 stabilization have been removed.
Biggest changes are:
- I/O driver internal rewrite. The windows implementation includes significant changes.
- Runtime API is polished, especially with how it interacts with feature flag combinations.
- Feature flags are simplified
rt-core
andrt-util
are combined tort
rt-threaded
is renamed tort-multi-thread
to match builder APItcp
,udp
,uds
,dns
are combied tonet
.parking_lot
is included withfull
- meta: Minimum supported Rust version is now 1.45.
- io:
AsyncRead
trait now takesReadBuf
in order to safely handle reading into uninitialized memory (#2758). - io: Internal I/O driver storage is now able to compact (#2757).
- rt:
Runtime::block_on
now takes&self
(#2782). - sync:
watch
reworked to decouple receiving a change notification from receiving the value (#2814, #2806). - sync:
Notify::notify
is renamed tonotify_one
(#2822). - process:
Child::kill
is now anasync fn
that cleans zombies (#2823). - sync: use
const fn
constructors as possible (#2833, #2790) - signal: reduce cross-thread notification (#2835).
- net: tcp,udp,uds types support operations with
&self
(#2828, #2919, #2934). - sync: blocking
mpsc
channel supportssend
with&self
(#2861). - time: rename
delay_for
anddelay_until
tosleep
andsleep_until
(#2826). - io: upgrade to
mio
0.7 (#2893). - io:
AsyncSeek
trait is tweaked (#2885). - fs:
File
operations take&self
(#2930). - rt: runtime API, and
#[tokio::main]
macro polish (#2876) - rt:
Runtime::enter
uses an RAII guard instead of a closure (#2954). - net: the
from_std
function on all sockets no longer sets socket into non-blocking mode (#2893)
- sync:
map
function to lock guards (#2445). - sync:
blocking_recv
andblocking_send
fns tompsc
for use outside of Tokio (#2685). - rt:
Builder::thread_name_fn
for configuring thread names (#1921). - fs: impl
FromRawFd
andFromRawHandle
forFile
(#2792). - process:
Child::wait
andChild::try_wait
(#2796). - rt: support configuring thread keep-alive duration (#2809).
- rt:
task::JoinHandle::abort
forcibly cancels a spawned task (#2474). - sync:
RwLock
write guard to read guard downgrading (#2733). - net: add
poll_*
functions that take&self
to all net types (#2845) - sync:
get_mut()
forMutex
,RwLock
(#2856). - sync:
mpsc::Sender::closed()
waits forReceiver
half to close (#2840). - sync:
mpsc::Sender::is_closed()
returns true ifReceiver
half is closed (#2726). - stream:
iter
anditer_mut
toStreamMap
(#2890). - net: implement
AsRawSocket
on windows (#2911). - net:
TcpSocket
creates a socket without binding or listening (#2920).
- io: vectored ops are removed from
AsyncRead
,AsyncWrite
traits (#2882). - io:
mio
is removed from the public API.PollEvented
andRegistration
are removed (#2893). - io: remove
bytes
from public API.Buf
andBufMut
implementation are removed (#2908). - time:
DelayQueue
is moved totokio-util
(#2897).
- io:
stdout
andstderr
buffering on windows (#2734).
- docs: misc improvements (#2572, #2658, #2663, #2656, #2647, #2630, #2487, #2621, #2624, #2600, #2623, #2622, #2577, #2569, #2589, #2575, #2540, #2564, #2567, #2520, #2521, #2493)
- rt: allow calls to
block_on
inside calls toblock_in_place
that are themselves insideblock_on
(#2645) - net: fix non-portable behavior when dropping
TcpStream
OwnedWriteHalf
(#2597) - io: improve stack usage by allocating large buffers on directly on the heap (#2634)
- io: fix unsound pin projection in
AsyncReadExt::read_buf
andAsyncWriteExt::write_buf
(#2612) - io: fix unnecessary zeroing for
AsyncRead
implementors (#2525) - io: Fix
BufReader
not correctly forwardingpoll_write_buf
(#2654) - io: fix panic in
AsyncReadExt::read_line
(#2541)
- coop: returning
Poll::Pending
no longer decrements the task budget (#2549)
- io: little-endian variants of
AsyncReadExt
andAsyncWriteExt
methods (#1915) - task: add
tracing
instrumentation to spawned tasks (#2655) - sync: allow unsized types in
Mutex
andRwLock
(viadefault
constructors) (#2615) - net: add
ToSocketAddrs
implementation for&[SocketAddr]
(#2604) - fs: add
OpenOptionsExt
forOpenOptions
(#2515) - fs: add
DirBuilder
(#2524)
- macros: disambiguate built-in
#[test]
attribute in macro expansion (#2503) - rt:
LocalSet
and task budgeting (#2462). - rt: task budgeting with
block_in_place
(#2502). - sync: release
broadcast
channel memory without sending a value (#2509). - time: notify when resetting a
Delay
to a time in the past (#2290)
- io:
get_mut
,get_ref
, andinto_inner
toLines
(#2450). - io:
mio::Ready
argument toPollEvented
(#2419). - os: illumos support (#2486).
- rt:
Handle::spawn_blocking
(#2501). - sync:
OwnedMutexGuard
forArc<Mutex<T>>
(#2455).
- sync:
broadcast
closing the channel no longer requires capacity (#2448). - rt: regression when configuring runtime with
max_threads
less than number of CPUs (#2457).
- docs: misc improvements (#2400, #2405, #2414, #2420, #2423, #2426, #2427, #2434, #2436, #2440).
- rt: support
block_in_place
in more contexts (#2409, #2410). - stream: no panic in
merge()
andchain()
when usingsize_hint()
(#2430). - task: include visibility modifier when defining a task-local (#2416).
- rt:
runtime::Handle::block_on
(#2437). - sync: owned
Semaphore
permit (#2421). - tcp: owned split (#2270).
- task:
LocalSet
was incorrectly marked asSend
(#2398) - io: correctly report
WriteZero
failure inwrite_int
(#2334)
- rt: bug in work-stealing queue (#2387)
- rt: threadpool uses logical CPU count instead of physical by default (#2391)
- sync: fix a regression where
Mutex
,Semaphore
, andRwLock
futures no longer implementSync
(#2375) - fs: fix
fs::copy
not copying file permissions (#2354)
- rt: fix queue regression (#2362).
- sync: Add disarm to
mpsc::Sender
(#2358).
- rt: concurrency bug in scheduler (#2273).
- rt: concurrency bug with shell runtime (#2333).
- test-util: correct pause/resume of time (#2253).
- time:
DelayQueue
correct wakeup afterinsert
(#2285).
- io: impl
RawFd
,AsRawHandle
for std io types (#2335). - rt: automatic cooperative task yielding (#2160, #2343, #2349).
- sync:
RwLock::into_inner
(#2321).
- sync: semaphore, mutex internals rewritten to avoid allocations (#2325).
- macros: unresolved import in
pin!
(#2281).
- net:
UnixStream::poll_shutdown
should callshutdown(Write)
(#2245). - process: Wake up read and write on
EPOLLERR
(#2218). - rt: potential deadlock when using
block_in_place
and shutting down the runtime (#2119). - rt: only detect number of CPUs if
core_threads
not specified (#2238). - sync: reduce
watch::Receiver
struct size (#2191). - time: succeed when setting delay of
$MAX-1
(#2184). - time: avoid having to poll
DelayQueue
after inserting new delay (#2217).
- macros:
pin!
variant that assigns to identifier and pins (#2274). - net: impl
Stream
forListener
types (#2275). - rt:
Runtime::shutdown_timeout
waits for runtime to shutdown for specified duration (#2186). - stream:
StreamMap
merges streams and can insert / remove streams at runtime (#2185). - stream:
StreamExt::skip()
skips a fixed number of items (#2204). - stream:
StreamExt::skip_while()
skips items based on a predicate (#2205). - sync:
Notify
provides basicasync
/await
task notification (#2210). - sync:
Mutex::into_inner
retrieves guarded data (#2250). - sync:
mpsc::Sender::send_timeout
sends, waiting for up to specified duration for channel capacity (#2227). - time: impl
Ord
andHash
forInstant
(#2239).
- docs: misc fixes and tweaks (#2155, #2103, #2027, #2167, #2175).
- macros: handle generics in
#[tokio::main]
method (#2177). - sync:
broadcast
potential lost notifications (#2135). - rt: improve "no runtime" panic messages (#2145).
- optional support for using
parking_lot
internally (#2164). - fs:
fs::copy
, an async version ofstd::fs::copy
(#2079). - macros:
select!
waits for the first branch to complete (#2152). - macros:
join!
waits for all branches to complete (#2158). - macros:
try_join!
waits for all branches to complete or the first error (#2169). - macros:
pin!
pins a value to the stack (#2163). - net:
ReadHalf::poll()
andReadHalf::poll_peak
(#2151) - stream:
StreamExt::timeout()
sets a per-item max duration (#2149). - stream:
StreamExt::fold()
applies a function, producing a single value. (#2122). - sync: impl
Eq
,PartialEq
foroneshot::RecvError
(#2168). - task: methods for inspecting the
JoinError
cause (#2051).
#[tokio::main]
whenrt-core
feature flag is not enabled (#2139).- remove
AsyncBufRead
fromBufStream
impl block (#2108). - potential undefined behavior when implementing
AsyncRead
incorrectly (#2030).
BufStream::with_capacity
(#2125).- impl
From
andDefault
forRwLock
(#2089). io::ReadHalf::is_pair_of
checks if providedWriteHalf
is for the same underlying object (#1762, #2144).runtime::Handle::try_current()
returns a handle to the current runtime (#2118).stream::empty()
returns an immediately ready empty stream (#2092).stream::once(val)
returns a stream that yields a single value:val
(#2094).stream::pending()
returns a stream that never becomes ready (#2092).StreamExt::chain()
sequences a second stream after the first completes (#2093).StreamExt::collect()
transform a stream into a collection (#2109).StreamExt::fuse
ends the stream after the firstNone
(#2085).StreamExt::merge
combines two streams, yielding values as they become ready (#2091).- Task-local storage (#2126).
AsyncSeek
impl forFile
(#1986).- rt: shutdown deadlock in
threaded_scheduler
(#2074, #2082). - rt: memory ordering when dropping
JoinHandle
(#2044). - docs: misc API documentation fixes and improvements.
- depend on new version of
tokio-macros
.
- potential deadlock when dropping
basic_scheduler
Runtime. - calling
spawn_blocking
from within aspawn_blocking
(#2006). - storing a
Runtime
instance in a thread-local (#2011). - miscellaneous documentation fixes.
- rt: fix
Waker::will_wake
to return true when tasks match (#2045). - test-util:
time::advance
runs pending tasks before changing the time (#2059).
net::lookup_host
maps aT: ToSocketAddrs
to a stream ofSocketAddrs
(#1870).process::Child
fields are made public to matchstd
(#2014).- impl
Stream
forsync::broadcast::Receiver
(#2012). sync::RwLock
provides an asynchonous read-write lock (#1699).runtime::Handle::current
returns the handle for the current runtime (#2040).StreamExt::filter
filters stream values according to a predicate (#2001).StreamExt::filter_map
simultaneously filter and map stream values (#2001).StreamExt::try_next
convenience for streams ofResult<T, E>
(#2005).StreamExt::take
limits a stream to a specified number of values (#2025).StreamExt::take_while
limits a stream based on a predicate (#2029).StreamExt::all
tests if every element of the stream matches a predicate (#2035).StreamExt::any
tests if any element of the stream matches a predicate (#2034).task::LocalSet.await
runs spawned tasks until the set is idle (#1971).time::DelayQueue::len
returns the number entries in the queue (#1755).- expose runtime options from the
#[tokio::main]
and#[tokio::test]
(#2022).
fs::File::seek
API regression (#1991).
io::AsyncSeek
trait (#1924).Mutex::try_lock
(#1939)mpsc::Receiver::try_recv
andmpsc::UnboundedReceiver::try_recv
(#1939).writev
support forTcpStream
(#1956).time::throttle
for throttling streams (#1949).- implement
Stream
fortime::DelayQueue
(#1975). sync::broadcast
provides a fan-out channel (#1943).sync::Semaphore
provides an async semaphore (#1973).stream::StreamExt
provides stream utilities (#1962).
- deadlock risk while shutting down the runtime (#1972).
- panic while shutting down the runtime (#1978).
sync::MutexGuard
debug output (#1961).- misc doc improvements (#1933, #1934, #1940, #1942).
- runtime threads are configured with
runtime::Builder::core_threads
andruntime::Builder::max_threads
.runtime::Builder::num_threads
is deprecated (#1977).
sync::Mutex
deadlock whenlock()
future is dropped early (#1898).
- read / write integers using
AsyncReadExt
andAsyncWriteExt
(#1863). read_buf
/write_buf
for reading / writingBuf
/BufMut
(#1881).TcpStream::poll_peek
- pollable API for performing TCP peek (#1864).sync::oneshot::error::TryRecvError
provides variants to detect the error kind (#1874).LocalSet::block_on
accepts!'static
task (#1882).task::JoinError
is nowSync
(#1888).- impl conversions between
tokio::time::Instant
andstd::time::Instant
(#1904).
- calling
spawn_blocking
after runtime shutdown (#1875). LocalSet
drop inifinite loop (#1892).LocalSet
hang under load (#1905).- improved documentation (#1865, #1866, #1868, #1874, #1876, #1911).
- scheduling with
basic_scheduler
(#1861). - update
spawn
panic message to specify that a task scheduler is required (#1839). - API docs example for
runtime::Builder
to include a task scheduler (#1841). - general documentation (#1834).
- building on illumos/solaris (#1772).
- panic when dropping
LocalSet
(#1843). - API docs mention the required Cargo features for
Builder::{basic, threaded}_scheduler
(#1858).
- impl
Stream
forsignal::unix::Signal
(#1849). - API docs for platform specific behavior of
signal::ctrl_c
andsignal::unix::Signal
(#1854). - API docs for
signal::unix::Signal::{recv, poll_recv}
andsignal::windows::CtrlBreak::{recv, poll_recv}
(#1854). File::into_std
andFile::try_into_std
methods (#1856).
- API docs for
TcpListener::incoming
,UnixListener::incoming
(#1831).
tokio::task::LocalSet
provides a strategy for spawning!Send
tasks (#1733).- export
tokio::time::Elapsed
(#1826). - impl
AsRawFd
,AsRawHandle
fortokio::fs::File
(#1827).
A major breaking change. Most implementation and APIs have changed one way or another. This changelog entry contains a highlight
- APIs are updated to use
async / await
. - most
tokio-*
crates are collapsed into this crate. - Scheduler is rewritten.
tokio::spawn
returns aJoinHandle
.- A single I/O / timer is used per runtime.
- I/O driver uses a concurrent slab for allocating state.
- components are made available via feature flag.
- Use
bytes
0.5 tokio::codec
is moved totokio-util
.
- Standalone
timer
andnet
drivers are removed, useRuntime
instead current_thread
runtime is removed, usetokio::runtime::Runtime
withbasic_scheduler
instead.
- Bump
tokio-trace-core
version to 0.2 (#1111).
tokio::runtime::Builder::panic_handler
allows configuring handling panics on the runtime (#1055).
- Re-export
tokio::sync::Mutex
primitive (#964).
TypedExecutor
re-export and implementations (#993).
- Propagate trace subscriber in the runtime (#966).
- async-await: track latest nightly changes (#940).
sync::Watch
, a single value broadcast channel (#922).- Async equivalent of read / write file helpers being added to
std
(#896).
- Use feature flags to break up the crate, allowing users to pick & choose components (#808).
- Export
UnixDatagram
andUnixDatagramFramed
(#772).
- Fix
Runtime::reactor()
when no tasks are spawned (#721). runtime::Builder
no longer uses deprecated methods (#749).- Provide
after_start
andbefore_stop
configuration settings forRuntime
(#756). - Implement throttle stream combinator (#736).
- runtime: expose
keep_alive
on runtime builder (#676). - runtime: create a reactor per worker thread (#660).
- codec: fix panic in
LengthDelimitedCodec
(#682). - io: re-export
tokio_io::io::read
function (#689). - runtime: check for executor re-entry in more places (#708).
- Fix
tokio-async-await
dependency (#675).
- Fix minimal versions
- Experimental async/await improvements (#661).
- Re-export
TaskExecutor
fromtokio-current-thread
(#652). - Improve
Runtime
builder API (#645). tokio::run
panics when called from the context of an executor (#646).- Introduce
StreamExt
with atimeout
helper (#573). - Move
length_delimited
intotokio
(#575). - Re-organize
tokio::net
module (#548). - Re-export
tokio-current-thread::spawn
in current_thread runtime (#579).
- Extract tokio::executor::current_thread to a sub crate (#370)
- Add
Runtime::block_on
(#398) - Add
runtime::current_thread::block_on_all
(#477) - Misc documentation improvements (#450)
- Implement
std::error::Error
for error types (#501)
- Add
Runtime::block_on
for concurrent runtime (#391). - Provide handle to
current_thread::Runtime
that allows spawning tasks from other threads (#340). - Provide
clock::now()
, a configurable source of time (#381).
- Add asynchronous filesystem APIs (#323).
- Add "current thread" runtime variant (#308).
CurrentThread
: Expose innerPark
instance.- Improve fairness of
CurrentThread
executor (#313).
- Provide timer API (#266)
- Fix build on FreeBSD (#218)
- Shutdown the Runtime when the handle is dropped (#214)
- Set Runtime thread name prefix for worker threads (#232)
- Add builder for Runtime (#234)
- Extract TCP and UDP types into separate crates (#224)
- Optionally support futures 0.2.
- Fix
CurrentThread::turn
to block on idle (#212).
- Introduce Tokio Runtime (#141)
- Provide
CurrentThread
for more flexible usage of current thread executor (#141). - Add Lio for platforms that support it (#142).
- I/O resources now lazily bind to the reactor (#160).
- Extract Reactor to dedicated crate (#169)
- Add facade to sub crates and add prelude (#166).
- Switch TCP/UDP fns to poll_ -> Poll<...> style (#175)
- Doc fixes
- Initial crate released based on RFC.