vibe.d beta banner
get vibe.d
0.8.5

Asynchronous I/O that doesn’t get in your way, written in D

Function createLeanTimer

Creates a new timer with a lean callback mechanism.

Timer createLeanTimer(CALLABLE) (
  CALLABLE callback
)
if (is(typeof(() { callback(); } ())));

In contrast to the standard createTimer, callback will not be called in a new task, but is instead called directly in the context of the event loop.

For this reason, the supplied callback is not allowed to perform any operation that needs to block/yield execution. In this case, runTask needs to be used explicitly to perform the operation asynchronously.

Additionally, callback can carry arbitrary state without requiring a heap allocation.

See also

createTimer

Authors

Sönke Ludwig

Copyright

© 2012-2019 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.