Skip to content
Snippets Groups Projects
Commit 75d78189 authored by g0dil's avatar g0dil
Browse files

Console: Documentation fix

parent 310f0375
No related branches found
No related tags found
No related merge requests found
...@@ -82,24 +82,25 @@ ...@@ -82,24 +82,25 @@
\until settings \until settings
This shows, how to set the top-level documentation and create a new subdirectory directly This shows, how to set the top-level documentation and create a new subdirectory.
\until mkdir \until doc
Here we create another new directory but save a reference so we can later access the node Here we create another new directory and save a reference so we can later access the node
directly. All the add commands return such a node reference of the correct type (this is a lie, directly. All the add commands return such a node reference of the correct type (this is a lie,
but it works like this anyways and it's an implementation detail that must not concern you but it works like this anyways and it's an implementation detail that must not concern you
here). here).
This way of stroing a refernce is not bad, but even better is to use a \c Instead of creating a new directory directly and later sotring a reference, it is better to use
senf::console::ScopedDirectory<> for this \c senf::console::ScopedDirectory<> like this:
\until functions \until functions
This will automatically remove the node from the tree when the senf::console::ScopedDiretory This will automatically remove the node from the tree when the \c senf::console::ScopedDirectory
instance is destroyed and keeps the node alive even when unlinked from the tree (a plain instance is destroyed. It also protects against the problem of dangling references: When using a
reference becomes invalid when anyone later unlinks the node from the tree). This is much safer plain reference, removing the directory from the tree will destroy the node. The reference
and is the preferred way to keep a hold on a directory. however will still reference the (now nonexistent) directory and any access via the reference
will crash the program.
The next statements add commands to the various directories declared so far The next statements add commands to the various directories declared so far
......
...@@ -113,7 +113,7 @@ int main(int, char **) ...@@ -113,7 +113,7 @@ int main(int, char **)
.add("testob", test.dir) .add("testob", test.dir)
.doc("Example of an instance directory"); .doc("Example of an instance directory");
senf::console::Server::start( senf::INet4SocketAddress(23232) ) senf::console::Server::start( senf::INet4SocketAddress(23232u) )
.name("testServer"); .name("testServer");
senf::Scheduler::instance().process(); senf::Scheduler::instance().process();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment