added USR1 signal to exit the program, also including some interface stuff

origin
steffen 5 years ago
parent 5843b0d365
commit 11dab29de7

@ -1,3 +1,7 @@
2021-03-07:
- fixed: high cpu load, sleep function was not working right. If the current
loop took below 1ms we would ot wait for the 25ms to finish.
2021-02-10:
- automatic mode with random destinations is working now

@ -9,9 +9,9 @@ ETCPREFIX=/etc
DISTNAME=modelbahn
CXX=g++
CXXFLAGS= -ggdb -fPIC -Wno-write-strings -g -ggdb -std=c++11
LDFLAGS= -lm -lc -lpthread -L/usr/local/lib -g -ggdb
LDFLAGS_CGI= -lm -lc -lpthread -L/usr/local/lib -g -ggdb
CXXFLAGS= -ggdb -fPIC -Wno-write-strings -g -ggdb -std=c++11 -pg
LDFLAGS= -lm -lc -lpthread -L/usr/local/lib -g -ggdb -pg
LDFLAGS_CGI= -lm -lc -lpthread -L/usr/local/lib -g -ggdb -pg
DEPENDFILE=.depend
TARGET=modelbahn-server
@ -25,10 +25,10 @@ CURDIR=`pwd`
all: dep $(TARGET) test-json modelbahn-cgi
modelbahn-server: $(SERVEROBJ)
$(CXX) -o $@ $^ $(LDFLAGS_CGI) -lUDPTCPNetwork -L./ -I./ -lpthread
$(CXX) -o $@ $^ $(LDFLAGS) -lUDPTCPNetwork -L./ -I./ -lpthread
modelbahn-cgi: modelbahn-cgi.o debug.o
$(CXX) -o $@ $^ $(LDFLAGS) -lUDPTCPNetwork -L./ -I./ -lpthread
$(CXX) -o $@ $^ $(LDFLAGS_CGI) -lUDPTCPNetwork -L./ -I./ -lpthread
test-json: json.o test-json.o debug.o
$(CXX) -o $@ $^ $(LDFLAGS) -L./ -I./ -lpthread

@ -37,6 +37,10 @@ int main (int argc, char **argv) {
fprintf (stderr, "%s:%d could not set signal for SIGHUB\n", __FILE__, __LINE__);
return 0;
}
if (signal(SIGUSR1, sig_int) == SIG_ERR) {
fprintf (stderr, "%s:%d could not set signal for SIGHUB\n", __FILE__, __LINE__);
return 0;
}
debug (0, "***************************************************");
@ -46,7 +50,6 @@ int main (int argc, char **argv) {
debug (0, "***************************************************");
debug (0, "");
//////////////////////////////////////////////////////////////////////
//
// application startup
@ -80,7 +83,6 @@ int main (int argc, char **argv) {
delete server;
debug (0, "* deleted server");
debug (0, "* application exited");
return 0;
};

@ -117,12 +117,12 @@ void Server::ThreadProcess() {
//
// mode manual
else if (mode == SMODE_MANUAL) {
server->locomotives.Loop();
}
//
// mode auto
else if (mode == SMODE_AUTO) {
server->locomotives.Loop();
}
gettimeofday (&tv, NULL);

@ -84,6 +84,7 @@ ul.GUIcontextmenuElements {
button {
padding: 6px 6px 6px 6px;
background-color: var(--input-bg-color);
color: var(--input-fg-color);
}

@ -1,4 +1,5 @@
<html>
<meta charset="utf-8">
<head>
<title>Modelbahn</title>
<script src="jquery-3.1.0.min.js"></script>

@ -7,7 +7,7 @@ body {
:root {
--top-height: 34px;
--side-width: 37px;
--bottom-height: 132px;
--bottom-height: 2px;
--menu-bg-color: #333;
--menu-fg-color: linen;

@ -14,7 +14,7 @@ const RAILWAY_BLOCK = 8;
var track = {
size: {x: -1, y: -1},
scale: 24,
scale: 32,
dbuf: {},
elements: []
};

Loading…
Cancel
Save