mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
simplified abnormal process termination
This commit is contained in:
parent
98cf27a102
commit
fb0a0ef83b
4 changed files with 3 additions and 20 deletions
|
@ -66,13 +66,6 @@
|
|||
struct settings;
|
||||
struct timespec;
|
||||
|
||||
/** The main thread id.
|
||||
* This is used to notify the main thread about
|
||||
* the program termination.
|
||||
* See error() macros.
|
||||
*/
|
||||
extern pthread_t _mtid;
|
||||
|
||||
/** Normal random variate generator using the Box-Muller method
|
||||
*
|
||||
* @param m Mean
|
||||
|
|
12
lib/utils.c
12
lib/utils.c
|
@ -92,17 +92,11 @@ double randf()
|
|||
return (double) random() / RAND_MAX;
|
||||
}
|
||||
|
||||
/** This global variable holds the main thread ID.
|
||||
* Its used by die().
|
||||
*/
|
||||
pthread_t _mtid;
|
||||
|
||||
void die()
|
||||
{
|
||||
if (pthread_equal(_mtid, pthread_self()))
|
||||
exit(EXIT_FAILURE);
|
||||
else
|
||||
pthread_kill(_mtid, SIGINT);
|
||||
int zero = 0;
|
||||
log_outdent(&zero);
|
||||
abort();
|
||||
}
|
||||
|
||||
char * strcatf(char **dest, const char *fmt, ...)
|
||||
|
|
|
@ -120,8 +120,6 @@ static void usage(const char *name)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
_mtid = pthread_self();
|
||||
|
||||
/* Check arguments */
|
||||
#ifdef ENABLE_OPAL_ASYNC
|
||||
if (argc != 2 && argc != 4)
|
||||
|
|
|
@ -62,8 +62,6 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
config_t config;
|
||||
|
||||
_mtid = pthread_self();
|
||||
|
||||
if (argc < 4) {
|
||||
printf("Usage: %s CONFIG TEST NODE [ARGS]\n", argv[0]);
|
||||
printf(" CONFIG path to a configuration file\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue