Commit Graph

35 Commits

Author SHA1 Message Date
rdb 9dec2aafb5 Fix static init ordering crashes in static build of pview
Fixes #381
2018-09-02 10:59:46 +02:00
Sam Edwards b2bfb31114 general: Remove `using std::*` from headers
Also remove most `using namespace std;` statements. The only one that remains is in py_panda.h.

Closes #350
Closes #335
2018-06-14 16:04:49 +02:00
Sam Edwards e2b4353800 general: Replace NULL (and 0 as pointer) with C++11 nullptr
Exceptions to this replacement are:
- .c files
- Headers included by a .c file
- stb_image.h
- dr_flac.h
- Strings
- Comments
2018-06-03 16:35:13 -06:00
rdb f45ddcab2f general: switch to C++11 Lockable semantics for mutexes
This renames acquire/release to lock/unlock in order to be compatible with std::lock_guard and std::unique_lock (which will eventually replace the *MutexHolder classes).  It will also allow us to typedef MutexImpl to std::mutex later on.
2018-05-23 20:37:56 +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
tobspr 0fcfb8e372 New file headers, new comment style 2016-02-17 17:47:48 +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 59e6a8a444 spam -> debug 2009-12-28 19:15:11 +00:00
David Rose ef771a796b make sync primitives more similar to python function names 2008-10-14 00:07:05 +00:00
David Rose 3bd5914b57 upon_birth race condition issues 2008-10-13 18:24:18 +00:00
David Rose 7683d94100 add TaskManager- events 2008-10-11 14:49:10 +00:00
David Rose 58f3f8f322 fix error at shutdown 2008-10-11 01:56:09 +00:00
David Rose a6a4a893d0 Task.sequence() 2008-10-05 00:24:55 +00:00
David Rose 7cca74a597 task.frame 2008-10-03 04:30:32 +00:00
David Rose fab502970f more threading improvements 2008-10-02 17:50:16 +00:00
David Rose 49a436f1b5 fix shutdown error some more 2008-09-29 23:55:37 +00:00
David Rose 0866bf9e51 better pstats 2008-09-29 22:20:52 +00:00
David Rose c8913d4b66 use global task manager 2008-09-29 17:29:49 +00:00
David Rose 2266110083 AsyncTask::is_runnable 2008-09-29 05:59:41 +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 5d8cd59628 live changes to set_sort, set_priority 2008-09-26 00:21:06 +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
David Rose 8b0461fadd const mistake 2008-09-19 18:06:57 +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
David Rose 197032bd70 add stop_threads() etc 2007-06-29 21:44:55 +00:00
David Rose 936412fae2 merge cow_thread_2007_04_12: make copy-on-write operations thread-safe 2007-04-19 18:23:10 +00:00
David Rose 601057c3a0 better pstats tracking of loader task 2007-04-09 20:55:25 +00:00
David Rose d56e5dabb6 explicit destructors 2006-08-30 17:04:23 +00:00
David Rose b3c42f22ac thread protection in miles 2006-08-30 15:21:10 +00:00
David Rose 3fe0ad1080 AsyncTaskManager, threaded sound loader 2006-08-29 19:27:03 +00:00