Oliver Kowalke
b859f8984a
add assertion in get_next_() ensures scheduler is set
2015-10-11 08:44:06 +02:00
Oliver Kowalke
950a1571bb
do not move yielded contexts in resume_()
2015-10-11 08:43:40 +02:00
Oliver Kowalke
01dda0048f
remove std::mutex associated with yield-queue
2015-10-11 08:42:48 +02:00
Oliver Kowalke
dbfd80fb2d
use yield-queue because work-sharing
...
- yield-queue prevents resumtion of a fiber which is passed to
awakened() but has not yet suspended
2015-10-10 21:52:03 +02:00
Oliver Kowalke
5357f7038e
scheduling-algorithm handles empty ready-queue
...
- if dispatcher-context detects empty ready-queue
the scheduler has to be suspended till signaled or
timeout reached
2015-10-03 09:35:47 +02:00
Oliver Kowalke
20196fcd69
set active context to nullptr in ~scheduler()
2015-09-30 19:58:04 +02:00
Oliver Kowalke
05bd4b9424
move context' from current scheduler to new, custom scheduler
2015-09-30 17:37:11 +02:00
Oliver Kowalke
5ee6570363
check for unwinding on correct conntext after resume
2015-09-29 20:10:10 +02:00
Oliver Kowalke
4c791a3790
support for fiber properties + custom scheduler
2015-09-29 17:54:29 +02:00
Oliver Kowalke
a847baa932
link/unlink of context protected by spinlock
2015-09-28 19:58:22 +02:00
Oliver Kowalke
eb7c4249d5
rename managed_is_linked() -> worker_is_linked()
2015-09-28 19:35:59 +02:00
Oliver Kowalke
fc404c58eb
unwind at shutdown
...
- scheduler holds a list of managed worker-fibers
- ~scheduler() requests stack unwinding for fibers not yet terminated
2015-09-24 17:35:40 +02:00
Oliver Kowalke
7668f86c26
more comments in scheduler.cpp
2015-09-23 17:44:50 +02:00
Oliver Kowalke
d3076f930b
some enhancements for scheduler
2015-09-23 17:44:35 +02:00
Oliver Kowalke
e38dc9b139
renaming of scheduler member functions
2015-09-22 19:30:29 +02:00
Oliver Kowalke
1ad58fbba1
add interruption
2015-09-21 20:18:53 +02:00
Oliver Kowalke
eec3d34fb0
remote ready-queue uses differrent hook than local ready-queue
2015-09-20 22:06:59 +02:00
Oliver Kowalke
22a1f1257d
some source code formating
2015-09-20 15:38:43 +02:00
Oliver Kowalke
558012bdcf
rewording of comments in scheduler implementation
2015-09-20 11:28:11 +02:00
Oliver Kowalke
6b01f060b7
class timed_mutex added
2015-09-19 18:03:41 +02:00
Oliver Kowalke
943e21e69b
add support for signaling a context as ready
2015-09-19 16:19:02 +02:00
Oliver Kowalke
59946d4426
add noexcept keyword to scheduler::wait_until() and context::wait_until()
2015-09-19 16:18:36 +02:00
Oliver Kowalke
6da902ff09
support sleep_for()/sleep_until()
2015-09-19 08:59:53 +02:00
Oliver Kowalke
8a9c9916c7
support this_fiber::yield()
2015-09-18 17:48:57 +02:00
Oliver Kowalke
7a794647ae
replace context::terminated_is_linked() by context::is_terminated()
...
- context::terminated_is_linked() might be missleading because this
state is transient
- if the context is pushed to the terminated-queue,
context::terminated_is_linked() returns true, if the context is
removed from terminated-queue context::terminated_is_linked() returns
false
- new flag flag_terminated intoduced
- flag_terminated will be set in context::set_terminated_(), which will
be called for worker context' in the lambda
2015-09-16 22:17:01 +02:00
Oliver Kowalke
70f4d9eeff
rename variable active-context scheduler
2015-09-16 22:10:23 +02:00
Oliver Kowalke
06e3037cc0
add comments ini scheduler
2015-09-16 21:17:42 +02:00
Oliver Kowalke
dd0e1d1893
add autoreset_event for waling up dispatcher context
...
- dispatcher waits on autoreset_event if ready-queue is empty
- autoreset_event is set if a ready context is pushed to the
ready-queue
2015-09-16 21:07:26 +02:00
Oliver Kowalke
a8e90aedb8
add joining a fiber
2015-09-16 20:51:26 +02:00
Oliver Kowalke
ddc5af0a36
run dispatcher context at scheduler destruction
2015-09-16 19:20:47 +02:00
Oliver Kowalke
6d43540a29
cleanup
2015-09-15 19:15:00 +02:00
Oliver Kowalke
73b3843696
test for ready-/runnabl-queue if transfered from remote_ready_queue
2015-09-13 16:35:54 +02:00
Oliver Kowalke
8c4dda107c
support signaling a fiber from another thread
...
- for this first version lockfree::queue<> is used
- maybe Dimitry Byukov's mpsc intrusive queue is better suited
2015-09-13 09:20:35 +02:00
Oliver Kowalke
f3b376224c
comments fxed + break loop of sleeping fibers
2015-09-11 21:35:39 +02:00
Oliver Kowalke
f14be69223
remove scheduler::wait:interval_ + fixups of comments
2015-09-11 21:03:09 +02:00
Oliver Kowalke
693c53d034
fix sleep_queue: cmp-op + use set<>::insert()
2015-09-11 20:45:54 +02:00
Oliver Kowalke
51d08226a4
if not fibers in queues - suspend till signaled or timeout
...
- if no fibers are ready to run suspend the thread and wait till
* signaled by scheduler::signal() for new fiber (ready to run)
* time_point of a sleeping fiber has reached
2015-09-11 20:45:54 +02:00
Oliver Kowalke
abd1ff524c
fixes for signaling interruption and wait
2015-09-11 18:42:16 +02:00
Oliver Kowalke
4764c1184c
signal() added
2015-09-10 19:52:08 +02:00
Oliver Kowalke
d3843efbe0
fix using intruisve::list<>
2015-09-10 18:08:10 +02:00
Oliver Kowalke
ce1b22b809
add sanity checks before destructing context in scheduler
2015-09-10 05:49:55 +02:00
Oliver Kowalke
fbf412aae1
delete termianted fibers
2015-09-09 21:04:56 +02:00
Oliver Kowalke
19c3df0862
ontext cleanup inf schedulerBitte geben Sie eine Commit-Beschreibung für Ihre Änderungen ein. Zeilen,
2015-09-09 19:36:30 +02:00
Oliver Kowalke
50791e3dd7
put main-context to yield-queue in ~scheduler()
2015-09-09 19:36:02 +02:00
Oliver Kowalke
9a59ee0a17
test explictly against nullptr
2015-09-09 19:35:33 +02:00
Oliver Kowalke
c89410dfd8
uses intrusive::list<> isntread hand-written queues
2015-09-09 19:22:54 +02:00
Oliver Kowalke
291b9d7c17
small fixes
2015-09-08 21:33:20 +02:00
Oliver Kowalke
6459b76075
do not use context::active() inside scheduler
2015-09-07 22:30:26 +02:00
Oliver Kowalke
2689e34be6
store pointer to main-context in scheduler
2015-09-07 22:29:57 +02:00
Oliver Kowalke
d66575e2e6
fiber_manager renamed to scheduler
2015-09-07 17:35:37 +02:00