Commit graph

75 commits

Author SHA1 Message Date
John M. Jones
ec0de9802b
Merge pull request #90 from nathanhourt/patch-1
Fix build against boost 1.68+
2018-11-21 06:35:11 -05:00
Peter Conrad
5b99b41a44 Added missing include 2018-11-10 21:29:32 +01:00
Nathan Hourt
2e0a03ac1f
Fix build against boost 1.68+
In Boost 1.68, the `boost/context/all.hpp` header was removed.
Ref: 2e37599461
If building against Boost 1.68+, use `boost/context/continuation_fcontext.hpp` instead.
2018-11-07 11:07:34 -06:00
Peter Conrad
018642659d Fixed some new code smells 2018-10-09 23:42:03 +02:00
Peter Conrad
d0b280aca7 Fixed possible deadlock 2018-10-09 23:28:02 +02:00
Peter Conrad
8eff001655 Initialize queues properly 2018-10-06 11:07:11 +02:00
Peter Conrad
fc61ef3d04 Improved error handling on thread exit 2018-10-06 11:06:35 +02:00
Peter Conrad
e336b0bb5c Added serial_valve 2018-10-05 15:02:31 +02:00
Peter Conrad
afcb1e3543 Moved do_parallel to fc::thread-based worker pool implementation 2018-10-03 21:25:10 +02:00
Peter Conrad
9d54742741 Added a mechanism to get notifications when a thread is idle 2018-10-03 21:25:10 +02:00
Peter Conrad
fa7f6af01f Delete broken (wrt fc::current_thread()) move stuff 2018-10-03 21:17:37 +02:00
Peter Conrad
7e8debbad4 Want to see thread names also in RelWithDebInfo build 2018-10-03 21:17:37 +02:00
Anton Autushka
7d7872cb7b some minor fixes 2018-02-06 15:37:14 +03:00
Alexey Frolov
5138c58e09 sanitize, remove warnings 2018-02-02 15:29:46 +03:00
Anton Autushka
20836338d2 Suppress coroutines deprecation warning in boost 1.62 2017-11-09 15:41:44 +03: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
Michael Vandeberg
013fbfb6a7 Remove logging on successful thread creation 2016-10-21 14:06:22 -04:00
Daniel Larimer
d352463e82 fix warnings generated by latest clang 2016-10-03 12:03:34 -04:00
Daniel Larimer
e7d0d26fe2 adding fixed_string definition 2016-09-15 15:29:16 -04:00
arhag
66d4b0841d Changes to fc to get MinGW cross-compilation working 2016-05-22 01:33:19 -04:00
theoreticalbts
83b4de067a future.cpp: Fix use-after-free bug cryptonomex/graphene#597 2016-02-25 03:04:45 -05:00
Daniel Larimer
e5ca765f15 clean up logging 2016-02-15 11:59:28 -05: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
drltc
16c0709500 Increase stack size to 2MB 2014-11-19 11:27:22 -05:00
dnotestein
27ac054883 Log thread creation and destruction 2014-11-03 16:59:19 -05: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
b63e6a8b81 Allow recursive fc::mutexes 2014-10-12 17:28:41 -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
dnotestein
10fdbcf5b3 Dequeue a thread from a blocking promise's notify list when the all the thread's tasks that are waiting on that promise are canceled. This prevents a crash when the promise is fulfilled after the thread is destroyed.
Re-organize read-loop execution to avoid crashes in read_loop on Win32 when ntp object destructs. Call quit on ntp_thread when ntp object destructs to free up thread (eventually we need to make fc::threads call quit in their destructor, but more work is required to make that work properly).
~fc::udp_socket now closes socket on destruction (consider doing this for tcp sockets as well).
2014-09-08 15:31:13 -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
ac385d1f6b Allow the user to supply a reason string when canceling a task (useful for debugging) 2014-08-27 14:07:44 -04:00
Eric Frias
8841f5e271 Import thread/task_specific variables 2014-08-27 12:20:19 -04:00
Eric Frias
d9e6a9e568 When a task is canceled while blocking on a mutex, fix the code that removes it from the mutex's block list to null out its "next" pointer, which is assumed to be null whenever not blocked on a mutex 2014-08-27 11:55:14 -04:00
Eric Frias
976bbce668 When locking a mutex, ensure the task has a context before attempting to lock. 2014-08-25 18:44:15 -04:00
Eric Frias
d188b138d6 Allow fc::canceled_exception to pass through places where we were catching and ignoring all fc::exceptions 2014-08-25 18:43:12 -04:00
Eric Frias
27096f15a7 Log the names of tasks to the log file (now contains thread_name:task_name} 2014-08-24 18:33:05 -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
dnotestein
7cc69f3bb7 Set canceled flag in task's context object so that we cancel out of active tasks when they try to resume. Wrap a try-catch block around tcp and udp resolve requests to convert any non-fc exceptions to fc exceptions. Minor change to clarify design intent that request_time_task should always be running in _ntp_thread. 2014-08-01 11:31:36 -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