Commit Graph

34 Commits

Author SHA1 Message Date
Younguk Kim 9ca0d089a6 event: fix a crash when removing a task is not owned by user 2018-04-10 19:45:54 +09:00
rdb ed5e5386b9 AsyncFuture improvements, incl. support for gathering futures 2017-12-21 14:07:01 +01: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
rdb a65b477734 Commit patches by cfsworks:
cxx: Fix missing includes masked by composite builds.
misc: Fix typos in comments.
config: Fix missing config forward-declarations.
direct: Adjust Python imports to panda3d.* instead of pandac.*.
display: Split graphicsWindow out into an extension.
framework: Use if/elif/elif/endif instead of ifdef/elif/elif/endif.
ode: Remove erroneous INLINE declarations.
interval: Fix missing import.
2014-10-19 22:41:47 +00:00
David Rose 279b3a8aeb support wx main loop in p3d system too 2012-01-14 01:18:10 +00:00
David Rose 93d625845c invert the WxGlobal loop: now wx owns the main loop, it seems to like that a lot better. 2012-01-14 00:16:05 +00:00
David Rose 4785161374 squelch some more compiler warnings 2011-06-18 00:16:48 +00:00
rdb 102b46878e More compatibility with exotic compilers (yes, I actually tried to port Panda to clang) 2010-04-07 16:59:46 +00:00
David Rose ea31a192b0 add frame_sync flag 2009-12-05 19:04:39 +00:00
David Rose 2cdd26901e yield thread for each task, and even when there are no tasks 2009-07-15 19:41:44 +00:00
David Rose 8407030245 recursive task manager message 2009-06-20 23:50:31 +00:00
David Rose eccea893f3 fix crash when no active tasks 2008-12-24 00:44:55 +00:00
David Rose 02d98e41c7 friendlier interface for task management 2008-10-14 02:17:38 +00:00
David Rose ef771a796b make sync primitives more similar to python function names 2008-10-14 00:07:05 +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 bca1533952 interrupt should not stop task 2008-10-10 21:30:11 +00:00
David Rose 907527a9c5 better scheduling algorithm 2008-10-10 20:54:15 +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 0866bf9e51 better pstats 2008-09-29 22:20:52 +00:00
David Rose a74bf92e67 combine DS_again with DS_restart 2008-09-29 18:37:10 +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 a29328046a fix some threading issues 2008-09-28 17:11:42 +00:00
David Rose 8bb89607ab DS_pickup 2008-09-27 15:56:50 +00:00
David Rose fd1218b07b task generators 2008-09-27 12:33:47 +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