Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
senf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wiback
senf
Commits
3490b9fe
Commit
3490b9fe
authored
17 years ago
by
g0dil
Browse files
Options
Downloads
Patches
Plain Diff
Utils/Daemon: BUGFIX: Fix command line argument parsing
Utils/Daemon: Add 'main()' documentatory example
parent
70312a50
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Utils/Daemon/Daemon.cc
+3
-2
3 additions, 2 deletions
Utils/Daemon/Daemon.cc
Utils/Daemon/Mainpage.dox
+27
-2
27 additions, 2 deletions
Utils/Daemon/Mainpage.dox
with
30 additions
and
4 deletions
Utils/Daemon/Daemon.cc
+
3
−
2
View file @
3490b9fe
...
...
@@ -151,7 +151,7 @@ prefix_ void senf::Daemon::detach()
namespace
{
/* Purposely *not* derived from std::exception */
struct
DaemonExitException
{
struct
DaemonExitException
{
DaemonExitException
(
unsigned
c
)
:
code
(
c
)
{}
unsigned
code
;
};
...
...
@@ -223,7 +223,8 @@ prefix_ void senf::Daemon::configure()
std
::
string
::
size_type
komma
(
arg
.
find
(
','
));
if
(
komma
==
std
::
string
::
npos
)
{
boost
::
trim
(
arg
);
consoleLog
(
arg
);
if
(
arg
==
std
::
string
(
"none"
))
consoleLog
(
""
);
else
if
(
!
arg
.
empty
())
consoleLog
(
arg
);
}
else
{
std
::
string
arg1
(
arg
,
0
,
komma
);
std
::
string
arg2
(
arg
,
komma
+
1
);
...
...
This diff is collapsed.
Click to expand it.
Utils/Daemon/Mainpage.dox
+
27
−
2
View file @
3490b9fe
...
...
@@ -36,7 +36,7 @@
// here after setting default parameters
senf::Daemon::configure();
}
void init() {
// Initialize application. Setup all necessary objects. After init()
// has completed, the startup should not fail
...
...
@@ -63,7 +63,32 @@
Since there are times, where separating init() and run() into two separate functions is
difficult, instead of defining init() and run(), the member main() may be defined. This member
must call detach() as soon as initialization is completed to detach from the foreground
terminal.
terminal.
\code
class MyDaemon : public senf::Daemon
{
// 'configure()' like above. Don't implement 'init()' or 'run()' if you implement 'main()'.
void main() {
// Initialize application. Setup all necessary objects. When implementing main(), the
// objects will most often live on the stack.
MyAppObject app;
if (some_error)
// Call Daemon::exit() to terminate execution prematurely
exit(1);
// After initialization is complete, you *must* call 'detach()'.
detach()
// Now we can start the application main loop
app.run();
}
};
\endcode
\see
\ref senf::Daemon class \n
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment