Commit Graph

16 Commits

Author SHA1 Message Date
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +02:00
rdb 9db74bca1d task: use consistent ordering for tasks with same sort value
We don't guarantee a specific order in this case, especially because they can be run in either order if there is more than one thread, but it is still useful to have a defined order for single-threaded task chains.  To that end, tasks
are now run in the order in which they were added to taskMgr.add (in absence of any other ordering constraints).

Fixes #309
2018-05-01 15:06:27 +02:00
rdb 2e20a0f16e Implement awaitable thread-safe future for async operations
This introduces AsyncFuture as a new base class of AsyncTask.  It's modelled after asyncio's Future class, except that it is thread-safe and you can use result() to block the current thread waiting for the future to finish (of course this is not necessary for use with coroutines).

AsyncFuture should be used for any operation that finishes in the future, to get the benefit of awaitability within coroutines as well as a standard interface for querying status and results of the operation as well as cancelling it.  As such, it's been implemented in various places, including texture.prepare() and win.trigger_copy().

Note that AsyncFuture is intended to be used *once*; it cannot be used more than once.  As an example of how this works, tex.prepare() will return the same future as long as the prepare isn't complete, but when it is done, subsequent calls to tex.prepare() will return a new future.
2017-12-04 22:25:28 +01:00
rdb 0c0f9adab9 Support coroutines and async/await in the task manager and loader 2017-10-31 18:56:41 +01:00
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +01:00
David Rose ea31a192b0 add frame_sync flag 2009-12-05 19:04:39 +00:00
David Rose 02d98e41c7 friendlier interface for task management 2008-10-14 02:17:38 +00:00
David Rose bca1533952 interrupt should not stop task 2008-10-10 21:30:11 +00:00
David Rose d4c2c9858d SIMPLE_THREADS_NO_MUTEX -> LightMutex 2008-10-08 23:23:40 +00:00
David Rose a6a4a893d0 Task.sequence() 2008-10-05 00:24:55 +00:00
David Rose c59bfe5459 more threading issues 2008-09-28 21:32:11 +00:00
David Rose 8bb89607ab DS_pickup 2008-09-27 15:56:50 +00:00
David Rose 7e217b8bdc handle more exotic uses of taskMgr 2008-09-26 23:42:22 +00:00
David Rose 72dad6e9d5 thread_priority, frame_budget, etc. 2008-09-26 19:58:11 +00:00
David Rose 306873b3ac task output 2008-09-25 23:20:59 +00:00
David Rose bf86abd1c5 task chains 2008-09-25 19:39:19 +00:00