Commit graph

38 commits

Author SHA1 Message Date
Peter Conrad
491fd31734 Replace 0 with nullptr 2019-06-19 17:39:45 +02:00
Peter Conrad
7506aaefe7 Moved retain/release to task_base 2019-06-06 14:39:14 +02:00
Dmitry Yakovitsky
55ad023d94 Fix memory leak. Not all tasks are deleted in thread_d dtor. 2019-05-14 17:31:28 +03:00
crypto-ape
918502e29e invalidate pointer to deleted object 2019-05-07 13:59:56 +02:00
Peter Conrad
579914c84d Removed unused stuff 2019-04-04 17:59:51 +02:00
Peter Conrad
018642659d Fixed some new code smells 2018-10-09 23:42:03 +02:00
Peter Conrad
9d54742741 Added a mechanism to get notifications when a thread is idle 2018-10-03 21:25:10 +02:00
Anton Autushka
c2a37a83bd Boost 1.61 compatibility fix 2017-11-09 15:18:58 +03:00
Vikram Rajkumar
d1faea2bde Revert incorrect start of boost compatibility update 2017-01-13 13:36:13 -06:00
Daniel Larimer
e7d0d26fe2 adding fixed_string definition 2016-09-15 15:29:16 -04:00
Daniel Larimer
6495004302 move potential yields outside of catch 2015-10-09 17:08:03 -04:00
Daniel Larimer
6872112ab0 adding extra checks for yielding while processing a catch 2015-10-05 08:44:24 -04:00
Eric Frias
307252e23a Call fc:🧵:quit() on thread destruction, and remove code that explicitly terminates threads from the destructors of the objects that own those threads.
Fix fc::thread to set the thread name in the Debugger when the name is set after thread construction.
When terminating a thread, cancel any tasks that have been schedule()d or async()ed but have not yet started executing.
When canceling a task blocked on a fc::mutex, notify the thread to reschedule the task to allow it to clean up the mutex's block list.
Fix a bug in managing the recursive lock count when tasks block on a fc::mutex
Reorder the code that manages the hard links for log files to avoid an exception generated by unlinking a locked file on Windows.
2014-10-21 10:25:28 -04:00
Eric Frias
b026e82451 Remove task priority hack that is no longer needed 2014-10-17 12:04:21 -04:00
Eric Frias
b34a222dc5 Remove #ifdefed-out code 2014-10-16 17:50:58 -04:00
Eric Frias
e5666cca54 Convert ready_head (list of fibers able to run immediately) into a priority heap 2014-10-16 16:26:19 -04:00
Eric Frias
1af4ac6a5c Schedule fibers in the order they are asynced or unblocked. Earlier behavior was always to start newly-asycned tasks before resuming existing tasks, so existing tasks could be starved if there was a steady stream of new tasks created. Now all tasks are started or resumed in the order they are created or unblocked. 2014-10-16 15:25:31 -04:00
Eric Frias
a426bf9710 whitespace and spelling fixes, no functional changes 2014-10-16 15:25:31 -04:00
Eric Frias
5a615e6b21 Execute async tasks in the order they were asynced (this only changes the behavior of tasks that hadn't started executing yet, it doesn't change anything about the order blocked tasks unblock) 2014-10-03 16:53:14 -04:00
Eric Frias
1daaab43ac Add assert to catch any time we yield during a catch{} block 2014-09-12 14:28:56 -04:00
Eric Frias
130da3623e Allow fibers to be canceled while they're sleeping or blocked on promises 2014-09-08 10:41:59 -04:00
Eric Frias
454573e048 Add support for boost 1.56. 2014-09-08 10:41:59 -04:00
Eric Frias
3222dc7c0b When reusing a context, re-initialize most of its fields. This fixes at least two errors:
- we were canceling tasks that hadn't been canceled, because the canceled flag was left set to true and the next task assigned to the context then became canceled as soon as it yielded
 - we were resumeing blocked tasks before they should have resumed, because their blocking_promises list wasn't cleared and they were unblocking because the erroneous promises were fulfilled
As a debugging aid, we also record the cancellation reason whenever a task is canceled, and include that in the canceled_exception (this is only enabled in debug builds)
2014-08-28 15:43:26 -04:00
Eric Frias
8841f5e271 Import thread/task_specific variables 2014-08-27 12:20:19 -04:00
Nathan Hourt
9e75d47ba3 Fix to an issue causing a thread to exit if any fiber therein self-cancels 2014-08-21 14:36:29 -04:00
Eric Frias
978de7885a Add a macro to check if a task that shouldn't yield actually yields. 2014-08-02 19:43:28 -04:00
Eric Frias
d847f6469a Allow us to require assigning descriptions to all async tasks to aid in debugging 2014-07-27 17:37:21 -04:00
Eric Frias
160da5dbb9 Fix invalid iterator comparison in process_canceled_tasks when canceling the only task in task_sch_queue 2014-06-29 18:50:05 -04:00
Daniel Larimer
892df5c0b7 canceled scheduled tasks return immediately when waited upon 2014-06-28 21:46:10 -04:00
Daniel Larimer
ffa617183e if a task is canceled before it is run, then it will throw a canceled exception 2014-06-28 21:08:15 -04:00
Eric Frias
f791cba36b Fix Keyhotee hang when setting system clock back bug 2014-04-01 15:22:53 -04:00
Eric Frias
e04d544016 Remove erroneous assert in fc::thread_d::check_for_timeouts()
I believe this assert was being triggered when the only task on
a thread did a fc::usleep (it might only have been when the
sleep was of very short duration).
2014-03-10 17:37:38 -04:00
dnotestein
c84b69e094 Fix for unblock to make sure it switches to proper thread before running async. 2014-01-06 17:08:36 -05:00
dnotestein
8e47816c4e Fix for problem reported with Boost 1.55 (memory_order_consume removed?). Also added move constructors for future, this second change probably needs review. 2013-12-12 09:19:15 -05:00
dnotestein
35077ea231 Set minimum sleep time to 10ms to avoid potential race where the thread wakes back up immediately after being put on sleep queue. This can probably be reduced to about 2ms, but this just seemed safer for now (DanL suggested 10ms). 2013-12-06 00:22:06 -05:00
Daniel Larimer
7bf6374299 MAJOR BUG FIX - fc::usleep causing hang&leak
In certain cases when usleep is passed a small value, there is
a race condition that would cause the process to hang and then
when an attempt to quit the thread was made new contexts would
be allocated rapidly filling all available memory.
2013-08-19 14:44:13 -04:00
Daniel Larimer
f5f3bb5102 error cleanup, log cleanup, bug fixes 2013-07-18 22:19:19 -04:00
Daniel Larimer
59a121d64b Updating FC with changes from phoenix-int 2013-06-05 15:19:00 -04:00
Renamed from src/thread_d.hpp (Browse further)