mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
avoid global storage as far as possible
This commit is contained in:
parent
ab4f84212f
commit
c3c37c267f
5 changed files with 29 additions and 26 deletions
|
@ -45,16 +45,8 @@
|
|||
|
||||
using namespace villas;
|
||||
|
||||
int cnt;
|
||||
|
||||
static std::atomic<bool> stop(false);
|
||||
|
||||
static Logger logger = logging.get("hook");
|
||||
|
||||
struct pool p = { .state = STATE_DESTROYED };
|
||||
struct hook h = { .state = STATE_DESTROYED };
|
||||
struct io io = { .state = STATE_DESTROYED };
|
||||
|
||||
static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
||||
{
|
||||
stop = true;
|
||||
|
@ -89,13 +81,19 @@ static void usage()
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret, recv, sent;
|
||||
int ret, recv, sent, cnt;
|
||||
const char *format = "villas.human";
|
||||
|
||||
struct format_type *ft;
|
||||
struct hook_type *ht;
|
||||
struct sample **smps;
|
||||
|
||||
Logger logger = logging.get("hook");
|
||||
|
||||
struct pool p = { .state = STATE_DESTROYED };
|
||||
struct hook h = { .state = STATE_DESTROYED };
|
||||
struct io io = { .state = STATE_DESTROYED };
|
||||
|
||||
/* Default values */
|
||||
cnt = 1;
|
||||
|
||||
|
|
|
@ -54,9 +54,6 @@ using namespace villas;
|
|||
using namespace villas::node;
|
||||
using namespace villas::plugin;
|
||||
|
||||
static SuperNode sn;
|
||||
static Logger logger = logging.get("node");
|
||||
|
||||
static std::atomic<bool> stop(false);
|
||||
|
||||
static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
||||
|
@ -110,6 +107,9 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
int ret;
|
||||
|
||||
SuperNode sn;
|
||||
Logger logger = logging.get("node");
|
||||
|
||||
try {
|
||||
|
||||
/* Check arguments */
|
||||
|
|
|
@ -51,9 +51,6 @@
|
|||
using namespace villas;
|
||||
using namespace villas::node;
|
||||
|
||||
static SuperNode sn; /**< The global configuration */
|
||||
static Logger logger = logging.get("pipe");
|
||||
|
||||
class Direction {
|
||||
|
||||
public:
|
||||
|
@ -77,6 +74,8 @@ static std::atomic<bool> stop(false);
|
|||
|
||||
static void quit(int signal, siginfo_t *sinfo, void *ctx)
|
||||
{
|
||||
Logger logger = logging.get("pipe");
|
||||
|
||||
if (signal == SIGALRM)
|
||||
logger->info("Reached timeout. Terminating...");
|
||||
|
||||
|
@ -107,6 +106,7 @@ static void usage()
|
|||
static void * send_loop(void *ctx)
|
||||
{
|
||||
Direction *d = static_cast<Direction *>(ctx);
|
||||
Logger logger = logging.get("pipe");
|
||||
|
||||
unsigned last_sequenceno = 0, release;
|
||||
int ret, scanned, sent, allocated, cnt = 0;
|
||||
|
@ -180,6 +180,7 @@ leave: if (io_eof(d->io)) {
|
|||
static void * recv_loop(void *ctx)
|
||||
{
|
||||
Direction *d = static_cast<Direction *>(ctx);
|
||||
Logger logger = logging.get("pipe");
|
||||
|
||||
int recv, ret, cnt = 0, allocated = 0;
|
||||
unsigned release;
|
||||
|
@ -235,6 +236,9 @@ int main(int argc, char *argv[])
|
|||
Direction sendd(&io);
|
||||
Direction recvv(&io);
|
||||
|
||||
SuperNode sn; /**< The global configuration */
|
||||
Logger logger = logging.get("pipe");
|
||||
|
||||
json_t *cfg_cli = json_object();
|
||||
|
||||
int c;
|
||||
|
|
|
@ -43,18 +43,12 @@
|
|||
|
||||
using namespace villas;
|
||||
|
||||
/* Some default values */
|
||||
struct node n;
|
||||
struct io io;
|
||||
struct pool q;
|
||||
struct sample *t;
|
||||
|
||||
static Logger logger = logging.get("signal");
|
||||
|
||||
static std::atomic<bool> stop(false);
|
||||
|
||||
json_t * parse_cli(int argc, char *argv[])
|
||||
{
|
||||
Logger logger = logging.get("signal");
|
||||
|
||||
/* Default values */
|
||||
double rate = 10;
|
||||
double frequency = 1;
|
||||
|
@ -177,6 +171,13 @@ int main(int argc, char *argv[])
|
|||
|
||||
const char *format = "villas.human"; /** @todo hardcoded for now */
|
||||
|
||||
struct node n;
|
||||
struct io io;
|
||||
struct pool q;
|
||||
struct sample *t;
|
||||
|
||||
Logger logger = logging.get("signal");
|
||||
|
||||
ret = utils::signals_init(quit);
|
||||
if (ret)
|
||||
throw new RuntimeError("Failed to intialize signals");
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
using namespace villas;
|
||||
using namespace villas::node;
|
||||
|
||||
static SuperNode sn;
|
||||
static Logger logger = logging.get("test-rtt");
|
||||
|
||||
static std::atomic<bool> stop(false);
|
||||
|
||||
void quit(int signal, siginfo_t *sinfo, void *ctx)
|
||||
|
@ -84,6 +81,9 @@ int main(int argc, char *argv[])
|
|||
|
||||
struct node *node;
|
||||
|
||||
SuperNode sn;
|
||||
Logger logger = logging.get("test-rtt");
|
||||
|
||||
/* Test options */
|
||||
int count = -1; /**< Amount of messages which should be sent (default: -1 for unlimited) */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue