Commit Graph

31 Commits

Author SHA1 Message Date
rdb 5e26aae1ff cleanup: Fix assorted issues uncovered by clang-tidy 2023-02-12 18:17:03 +01:00
rdb 0747f46055 event: Improve interface for adding tasks from C++
The order of arguments is now the same as in Python (with the callable first), sort and priority arguments have been added, and new tasks can be added directly to a chain
2022-12-26 19:10:01 +01:00
rdb b4d51c24e9 event: Remove FunctionAsyncTask
To create a task from a lambda, it is more efficient to use the new AsyncTaskManager::add() short-hand which creates an AsyncTask subclass in-place.
2022-02-22 18:02:34 +01:00
rdb 7baeaf3809 event: New C++ AsyncTaskManager::add() no longer uses std::function
std::function has unnecessary overhead, better to just create an AsyncTask subclass in-place storing the closure

This obsoletes FunctionAsyncTask, it will be removed in a future commit
2022-02-22 17:02:42 +01:00
rdb 4af5bc9e6d event: Support lambdas as tasks via new FunctionAsyncTask
This is intended to replace GenericAsyncTask.
2021-11-29 14:47:44 +01:00
rdb 11b5f09819 general: replace remaining references to ConditionVarFull. 2019-02-11 16:23:16 +01:00
Sam Edwards 7790f8429d general: Fully qualify header references into the std namespace
Closes #341
2018-06-07 10:35:12 +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 dd2806c8bd Mark constructors 'explicit' for which coercion makes no sense 2017-11-06 19:47:38 +01:00
rdb 0c0f9adab9 Support coroutines and async/await in the task manager and loader 2017-10-31 18:56:41 +01:00
rdb ce29ae490d Interrogate improvements, more properties, MAKE_SEQ_PROPERTY 2016-05-11 00:16:53 +02:00
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +01:00
rdb dafe48a6bc Begin to add snake_case/property interfaces to important direct classes 2015-12-26 17:00:51 +01:00
rdb 33d494d0f4 make AsyncTaskManager::_global_ptr an ordinary pointer to prevent static init issues with PandaFramework 2012-08-15 10:55:40 +00:00
David Rose f165019d2b correct comment 2009-11-19 15:36:27 +00:00
David Rose 58e0537e3c wide interrogate improvements: sequence protocol, MAKE_SEQ, __setitem__, and parameter coercion 2008-11-07 21:12:42 +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 4beba6ca6f integrate pview with new task manager 2008-10-03 20:30:07 +00:00
David Rose c8913d4b66 use global task manager 2008-09-29 17:29:49 +00:00
David Rose c59bfe5459 more threading issues 2008-09-28 21:32:11 +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 bf86abd1c5 task chains 2008-09-25 19:39:19 +00:00
David Rose 524128b9fd wip: starting experimental C-based task manager 2008-09-19 00:58:04 +00:00
David Rose fb9c56432a we are now using the modified BSD license 2008-05-28 18:37:20 +00:00
David Rose 4c2659988f minor threading fixes 2007-11-27 01:18:35 +00:00
Zachary Pavlov 220d33e006 okay, this is going to be a big commit. The basic idea here is to add transparent defines to allow for directory based dlls later. This will let us build tau again. ugggg 2007-07-20 23:02:51 +00:00
David Rose 197032bd70 add stop_threads() etc 2007-06-29 21:44:55 +00:00
David Rose 601057c3a0 better pstats tracking of loader task 2007-04-09 20:55:25 +00:00
David Rose 3fe0ad1080 AsyncTaskManager, threaded sound loader 2006-08-29 19:27:03 +00:00