Oliver Kowalke
558012bdcf
rewording of comments in scheduler implementation
2015-09-20 11:28:11 +02:00
Oliver Kowalke
33093a2122
add missing header in operations.hpp
2015-09-20 11:27:42 +02:00
Oliver Kowalke
b3660a3432
reorder member variables of context
...
- member hooks must be destroyed before execution_context
- otherwise an segementation fault is caused
- destruction of execution_context deallocates stack on which
the member variables of context are allocated
2015-09-20 11:25:32 +02:00
Oliver Kowalke
067547f18e
remove unused context::deallocate()
2015-09-20 11:24:27 +02:00
Oliver Kowalke
c8a1c4e4df
class recursive_timed_mutex added
2015-09-19 18:14:17 +02:00
Oliver Kowalke
6b01f060b7
class timed_mutex added
2015-09-19 18:03:41 +02:00
Oliver Kowalke
1797badafc
fix memory ordering for release-op (spinlock/mutex/recursive_mutex)
2015-09-19 17:38:10 +02:00
Oliver Kowalke
e6ddbe10a1
class recursive_mutex added
2015-09-19 17:27:45 +02:00
Oliver Kowalke
44d4ce82e0
use atomic< context * > as owner type
2015-09-19 17:26:33 +02:00
Oliver Kowalke
3f5e076f3a
class mutex added
2015-09-19 17:01:20 +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
4e1e9fc240
reminder/comment in scheduler
2015-09-19 16:14:06 +02:00
Oliver Kowalke
a89f4a5979
protect context' wait-queue for concurrent access
...
- protect wait-queue as well termiantion flag
2015-09-19 09:32:14 +02:00
Oliver Kowalke
bbf41e95f3
add spinlock used to protect forr concurrent access (threads)
...
- calls std::this_thread::yield()
2015-09-19 09:31:22 +02:00
Oliver Kowalke
6da902ff09
support sleep_for()/sleep_until()
2015-09-19 08:59:53 +02:00
Oliver Kowalke
8d41c994af
add unit-test for joining a fiber running in another fiber
2015-09-18 18:33:35 +02:00
Oliver Kowalke
8a9c9916c7
support this_fiber::yield()
2015-09-18 17:48:57 +02:00
Oliver Kowalke
7d448f4943
enhance unit-test: fiber-fn with additional arguments
2015-09-18 17:37:02 +02:00
Oliver Kowalke
bf0ea3749b
add TODO comments
2015-09-18 17:32:19 +02:00
Oliver Kowalke
a8d426cc5f
add more fiber tests
2015-09-16 22:21:51 +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
00ae711cd7
join only non-terminated fibers
...
- context::join() adds active-context to wait-queue only
if joined context is not terminated
- we can not use terminated_is_linked() because the context
might already be removed from scheudler's termianted-queue
2015-09-16 22:11:11 +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
eafeaaae01
remove examples and tests
2015-09-16 19:12:57 +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
fe337fdf4c
fix autoreset_event::reset()
2015-09-11 21:59:33 +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
070606d2d1
disable asio examples
...
- interaction with external event-loops not implemented
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
c416b6fe1e
disable test with multi-threading
...
- scheduler::remote_signal() not implemented yet
2015-09-11 20:11:56 +02:00
Oliver Kowalke
abd1ff524c
fixes for signaling interruption and wait
2015-09-11 18:42:16 +02:00
Oliver Kowalke
e44a41b71e
add output 'done' at the end of examples
2015-09-11 18:41:46 +02:00
Oliver Kowalke
ebd147c08d
fix join(), this_fiber::sleep_until()
2015-09-10 20:42:28 +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
2173200c14
example simple
2015-09-10 18:07:41 +02:00
Oliver Kowalke
ce1b22b809
add sanity checks before destructing context in scheduler
2015-09-10 05:49:55 +02:00
Oliver Kowalke
c1d3d478d8
use wait_queue with safe_link featurre, use erase_and_dispose() for
...
unlinking
2015-09-10 05:49:10 +02:00
Oliver Kowalke
08d4537a45
Merge pull request #66 from nat-goodspeed/develop
...
Fix hang in priority.cpp
2015-09-10 05:35:51 +02:00
Nat Goodspeed
c9bd8360b4
Merge branch 'develop' of http://github.com/olk/boost-fiber into develop
2015-09-09 21:47:46 -04:00
Nat Goodspeed
2b6135364e
Make awakened() unconditionally insert fiber.
...
There was a bug when the ready queue wasn't empty, but there was no
lower-priority fiber already in the queue. In that case the fiber wouldn't be
inserted. We want the loop just to advance the iterator, but to perform the
insert regardless of where the iterator ends up. (With this logic, empty() is
no longer a special case.)
Restore the ~Verbose() message.
2015-09-09 21:46:35 -04:00