Commit graph

4740 commits

Author SHA1 Message Date
458fda4058 DispatcherLoop implementation complete (closes #1049)
Did a full review of state and locking logic, seems airtight now.
- command processing itself is unimplemented, we log a TODO message for now
- likewise, builder is not implemented
- need to add the deadlock safeguard #1054
2017-01-05 23:36:42 +01:00
b0b662f200 DispatcherLoop: fix race on initialisation 2017-01-05 22:35:33 +01:00
3915e3230e DispatcherLoop: add wake-up notification on state change 2017-01-05 21:40:37 +01:00
f26ef5230c CommandQueue: finish integration into ProcDispatcher
...leaving out the *actual operations* of
- command dispatch
- builder run
2017-01-05 20:43:53 +01:00
1b970cd943 Session-Subsytem(#318): finish review of locking and lifecycle sanity
This subsystem as such can be considered as implemented now,
while several details still wait to be filled in.
2017-01-05 03:38:46 +01:00
3809240312 ProcDispatcher(#318): forgo joining the loop thread to avoid deadlock
Due to object scoping we can conclude reliably that the only one
ever to delete the DispacherLoop object will be the the loop thread
from within this object itself, when invoking the termination callback.

Btw, the lock on the inner object was insufficient and will be
replaced by taking the outer lock
2017-01-05 02:00:35 +01:00
567b00aa21 DOC: follow-up of removing boost::scoped_ptr 2017-01-05 01:20:34 +01:00
cd8844b409 clean-up: kill Boost scoped_ptr
std::unique_ptr is a drop-in replacement
2017-01-05 00:56:46 +01:00
77303ad007 Session-Subsystem(#318): investigation of locking sanity (ongoing...)
Found an inconsistency and a deadlock!
See proc-dispatcher.cpp, the lambda embedded into the start() operation!
2017-01-04 01:44:35 +01:00
34686713d4 Proc-Layer: Builder is not a subsystem (anymore)
We found out that it's best to run it single threaded
within the session loop thread. This does not mean the Builder
itself is necessarily single threaded, but the Builder's top level
will block any other session operation, and this is a good thing.
For this reason it makes more sense to have the Builder integrated
as a component into the session subsystem.
2017-01-03 21:10:27 +01:00
282829956b ProcDispatcher: integrate queue and finish preliminary implementation draft
TODO: the wakeup / notification on changes still needs to be done consistently
2016-12-25 22:26:16 +01:00
3010c87008 CommandQueue: basic queue behaviour implemented and tested 2016-12-25 21:52:52 +01:00
b58427e49f Command-Framework: mark anonymous commands
It turns out we *do* support the use of anonymous commands
(while it is not clear yet if we really need this feature).

Basically, client code may either create and register a new
instance from another command used as prototype, by invoking
Command::storeDef(ID). Or, alternatively it may just invoke
newInstance() on the command, which creates a new handle
and a valid new implementation (managed by the handle as
smart-ptr), but never stores this implementation into the
CommandRegistry. In that case, client code may use such a
command just fine, as long as it cares to hold onto that
handle; but it is not possible to retrieve this command
instance later by symbolic ID.

In the light of this (possible) usage pattern, it doesn't
make sense to throw when accessing a command-ID. Rather, we
now return a placeholder-Symbol ("_anonymous_")
2016-12-25 21:46:58 +01:00
387a553e98 Lib: fix warning regarding subobject-linkage
And yes, this warning is for real, while the compiler has no way
to decide if there is actual danger lurking. A type with internal
linkage (e.g. defined in an anonymous namespace) will be treated
by the linker as a separate entity on each encounter (i.e. in
each distinct compilation unit). When multiple translation units
start collaborating on such a type, they *might* be referring
to different memory locations, while semantically the intention
is to refer to the same location.

And since we're dealing with a library facility here, *we* have
likewise now power to ensure proper usage, so we better be cautious.
2016-12-25 20:09:24 +01:00
3501732839 CommandQueue: simple interface 2016-12-25 19:30:59 +01:00
b5590fb22c CommandQueue: prepare for an unit test 2016-12-25 18:49:57 +01:00
b6d5cd1c76 SessionCommandService implemented by delegating to the ProcDispatcher 2016-12-23 23:42:27 +01:00
b3f0605b9b SessionCommand-facade: consider how to expose command invocation
after reading some related code, I am leaning towards a design
to mirror the way command messages are sent over the UI-Bus.

Unfortunately this pretty much abandons the possibility to
invoke these operations from a client written in C or any
other hand made language binding. Which pretty much confirms
my initial reservation towards such an excessively open
and generic interface system.
2016-12-23 07:26:00 +01:00
386c15f039 obviously a better name
...since it became customary to have make_tuple, make_shared, make_unique
2016-12-23 04:24:22 +01:00
1a4b6545a0 maximum munch
...feels like X-mas
2016-12-23 04:23:03 +01:00
39060297ee ProcDispatcher: solve the sync waiting for a "checkpoint"
...based on the logic of the whole loop
2016-12-22 21:36:03 +01:00
8bbc0fb97f more clean-up and comments 2016-12-22 19:35:42 +01:00
ad6a2ef090 ProcDispatcher: fix possible race at startup 2016-12-22 18:42:12 +01:00
0d436deb9e clean-up and comments for the implementation finished thus far 2016-12-22 04:04:41 +01:00
99b9af0a74 Looper: loop control logic unit test PASS 2016-12-22 03:28:41 +01:00
96def6b1ba Looper: elaborate implementation
looks doable indeed...
2016-12-22 03:12:14 +01:00
196696a8d0 Looper: draft possible implementation
seemingly a quite simple "trap door" mechanism is sufficient
2016-12-21 03:56:56 +01:00
ef6ecf3dd0 Looper: rework the spec for the builder triggereing behaviour
...still don't know how to implement it, but now it is at least
specified more correct, with respect to the implementation of the loop
2016-12-21 03:15:36 +01:00
6073df3554 Looper: other (better?) idea how to handle "builder dirty" automatically
...this means to turn Looper into a state machine.
Yet it seems more feasible, since the DispatcherLoop has a nice
checkpoint after each iteration through the while loop, and we'd
keep that whole builder-dirty business completely confined within
the Looper (with a little help of the DispatcherLoop)

Let's see if the state transition logic can actually be implemented
based just on such a checkpoint....?
2016-12-20 03:53:48 +01:00
14e0d65468 Looper: idea how to determine "builder dirty"
...just by offloading that task onto the CommandQueue,
which happens to know when a new command is being scheduled
2016-12-20 03:18:03 +01:00
bae3d4b96f mark a solution how to create a safeguard against deadlock on session shutdown
....if by some weird coincidence, a command dispatched into the session
happens to trigger session shutdown or re-loading, this will cause a deadlock,
since decommissioning of session data structures must wait for the
ProcDispatcher to disable command processing -- and this will obviously
never happen when in a callstack below some command execution!
2016-12-20 02:35:45 +01:00
746866f5fc Looper: draft requirements on logic for triggering the builder 2016-12-16 23:56:53 +01:00
b873f7025b ProcDispatcher: mark some next tasks to care for 2016-12-16 23:26:56 +01:00
53ed0e9aa3 ProcDispatcher: consider and document the fine points of operational semantics
there are some pitfalls related to timing and state,
especially since some state changes are triggered, but not immediately reached
2016-12-16 23:11:19 +01:00
8ee08905b3 Looper: extend test coverage 2016-12-16 20:38:00 +01:00
30254da95f Looper: implement core operation control logic 2016-12-16 19:21:06 +01:00
9c9e75ee01 Looper: define testcase regarding activity control 2016-12-16 18:40:29 +01:00
af92ed505b Looper: implementation 2016-12-16 18:34:04 +01:00
be97473779 Looper: define first basic testcase 2016-12-16 18:23:46 +01:00
5fd65d6613 Looper: test setup 2016-12-16 18:09:51 +01:00
7b860947b1 ProcDispatcher: skeleton of the processing loop
including a draft of the Looper control component and the
invocation of the object monitor for waiting on condition var
2016-12-15 22:15:20 +01:00
00077d0431 ProcDispatcher: decide on requirements and implementation structure (#1049) 2016-12-15 20:48:35 +01:00
7e65dda771 draft request to halt the dispatcher loop 2016-12-15 06:21:59 +01:00
86f446c197 better control of the shutdown sequence
holding the SessionCommandService in a unique_ptr allows us to
close the Interface reliably *before* the Loop is halted.
2016-12-15 05:54:48 +01:00
a3c22b8aff SessionCommandService to be operated by the DispatcherLoop 2016-12-15 05:38:12 +01:00
715d3d2890 fix indentation 2016-12-15 05:31:56 +01:00
4d45dfd4be introduce CommandDispatch interface
this allows to let the DispatcherLoop actually serve
as implementation facility for the SessionCommandService
2016-12-15 05:21:03 +01:00
1ec883787a DOC: decision about where to home the SessionCommandService
After some consideration, it became clear that this service implementation
is closely tied to the DispatcherLoop -- which will consequently be
responsible to run and expose this service implementation
2016-12-15 05:07:40 +01:00
eb73242113 document decisions regarding session subsystem components and lifecycle
* "session subsystem" == running the ProcDispatcher
* session itself is pulled up on demand by the SessionManager
2016-12-14 05:10:51 +01:00
479f4170c2 implement activated state
need to keep state variables on both levels,
since the session manager (lifecycle) "opens" the session
for external access by starting the dispatcher; it may well happen
thus that the session starts up, while the *session subsystem*
is not(yet) started
2016-12-14 04:57:08 +01:00