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
dnotestein
9e320a3db8
Add descriptions for a bunch of async tasks, remove logging during thread::quit to avoid crashes for now until we cleanup thread quit code
2014-07-27 00:09:15 -04:00
dnotestein
34296fbb4a
Eliminate local variable that was shadowing data member variable stack_ctx in context object, which resulted in an assert when the context object was destructed.
2014-07-24 15:18:53 -04:00
Daniel Larimer
6ef73a4198
reduce default stack size by 50% to 4x default from 8x
2014-07-17 23:03:23 -04:00
Daniel Larimer
eed62c8338
sockets now wait for any pending write or read operations to finish before destructing
2014-07-17 17:03:25 -04:00
Vikram Rajkumar
e9b1b8ec2e
Use a separate thread for log compression
2014-07-03 17:24:06 -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
dnotestein
bf9bd5a9f6
Increase task context stack from 64K to 8*64K to prevent the stack from overflowing in the p2p code.
2014-06-16 16:59:37 -04:00
Eric Frias
c63e598497
Fix a race that occurred when notifying a thread that was blocked on a
...
promise to wake up, but that thread simultaneously awoke for another
reason (probably a timeout)
2014-04-14 16:27:08 -04:00
Eric Frias
061007ee29
In debug builds, set the thread name in the debugger to match the name given to fc::thread ctor
2014-04-01 16:56:11 -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
Eric Frias
fdbaf88e5e
Provide a way to intercept Win32 structured exceptions in async tasks
...
Something about the stacks created by boost::context prevents global structured exception handlers
from being called. This allows the user to register a handler which will be called when there
is an unhandled structured exception in async task.
2014-03-08 18:48:19 -05:00
vogel76
08ab455dff
[BW]: [Fix] fc::task_base class member initialization.
2014-01-06 23:58:42 +01: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