Commit graph

57 commits

Author SHA1 Message Date
Peter Conrad
cd69d13348 Replaced spin_yield_lock with atomics 2019-09-18 15:12:27 +02:00
Peter Conrad
deb9d4f0a6 Make task internal storage private 2019-06-19 17:40:22 +02:00
Peter Conrad
3fa4fa6148 Fixed typo 2019-06-19 17:31:54 +02:00
Peter Conrad
b16bf00a10 Made task_base destructor virtual 2019-06-10 23:25:56 +02:00
Peter Conrad
40797b1026 Fixed typo 2019-06-10 18:52:46 +02:00
Peter Conrad
8ad041cea0 Replaced fc::deduce with std::remove_reference<std::remove_const<>> 2019-06-06 14:41:47 +02:00
Peter Conrad
0aac8a4afc Replaced fc::forward with std::forward 2019-06-06 14:41:47 +02:00
Peter Conrad
7506aaefe7 Moved retain/release to task_base 2019-06-06 14:39:14 +02:00
Peter Conrad
19bbc4080e Added retain where applicable 2019-06-06 14:39:14 +02:00
Peter Conrad
7cf371736b Intermediate 2019-06-06 14:39:14 +02:00
Abit
67e5a06035
Merge pull request #119 from bitshares/shared-ws-client-ptr
Use shared_ptr to WS connection in API connection
2019-05-10 15:24:15 +02:00
abitmore
127aadbffc Add function to send signals to threads 2019-05-07 19:21:43 -04:00
Peter Conrad
579914c84d Removed unused stuff 2019-04-04 17:59:51 +02:00
Peter Conrad
ed775a594f Added missing include 2018-11-14 17:54:09 +01: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
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
9954a3775c Added constructor for auto-fulfillment 2018-10-03 21:08:42 +02:00
Peter Conrad
34a2820c90 Added warning 2018-10-03 21:08:42 +02:00
Peter Conrad
3131c1df43 Implement helper function for real parallel execution 2018-10-03 10:51:15 +02:00
Alexey Frolov
5138c58e09 sanitize, remove warnings 2018-02-02 15:29:46 +03:00
Daniel Larimer
815f07506c small formatting issues and helper api 2016-10-18 11:53:26 -04:00
drltc
ff1152e55d Add sync_call() for calling a functor in another thread and waiting on it 2014-12-15 15:40:20 -05:00
drltc
16c0709500 Increase stack size to 2MB 2014-11-19 11:27:22 -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
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
b63e6a8b81 Allow recursive fc::mutexes 2014-10-12 17:28:41 -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
27096f15a7 Log the names of tasks to the log file (now contains thread_name:task_name} 2014-08-24 18:33:05 -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
8fa21821ae Suppress "inherited via dominance" warning 2014-08-02 15:49:07 -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
Vikram Rajkumar
f644b1e475 Fix compiler warning 2014-07-27 20:46:39 -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
24ba357b0d Make future's cancel_and_wait automatically swallow the canceled_exception since it is expected. 2014-07-26 14:51:48 -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
Daniel Larimer
c33acad0ab fix udt sockets, actually enable non blocking operation 2014-06-29 01:38:46 -04:00
Daniel Larimer
d2072e9d3a updates to thread / udt socket 2014-06-26 20:10:56 -04:00
HackFisher
8b73226312 This should be a typo, fix it.
move ">" before #endif
2014-03-09 16:18:00 +08: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