Combine 'global' with connection code

This commit is contained in:
Iwan Timmer
2017-05-28 13:17:40 +02:00
parent a7e3aa354e
commit 49a447c3d4
6 changed files with 12 additions and 58 deletions

View File

@@ -18,12 +18,15 @@
*/
#include "connection.h"
#include "global.h"
#include <stdio.h>
#include <signal.h>
static void connection_connection_terminated() {
quit();
pthread_t main_thread_id = 0;
static void connection_terminated() {
if (main_thread_id != 0)
pthread_kill(main_thread_id, SIGTERM);
}
static void connection_display_message(const char *msg) {
@@ -39,7 +42,7 @@ CONNECTION_LISTENER_CALLBACKS connection_callbacks = {
.stageComplete = NULL,
.stageFailed = NULL,
.connectionStarted = NULL,
.connectionTerminated = connection_connection_terminated,
.connectionTerminated = connection_terminated,
.displayMessage = connection_display_message,
.displayTransientMessage = connection_display_transient_message,
};

View File

@@ -1,7 +1,7 @@
/*
* This file is part of Moonlight Embedded.
*
* Copyright (C) 2015 Iwan Timmer
* Copyright (C) 2015-2017 Iwan Timmer
*
* Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -19,4 +19,7 @@
#include <Limelight.h>
#include <pthread.h>
extern CONNECTION_LISTENER_CALLBACKS connection_callbacks;
extern pthread_t main_thread_id;

View File

@@ -1,27 +0,0 @@
/*
* This file is part of Moonlight Embedded.
*
* Copyright (C) 2015 Iwan Timmer
*
* Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Moonlight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
*/
#include <signal.h>
#include <pthread.h>
pthread_t main_thread_id;
void quit() {
pthread_kill(main_thread_id, SIGTERM);
}

View File

@@ -1,24 +0,0 @@
/*
* This file is part of Moonlight Embedded.
*
* Copyright (C) 2015 Iwan Timmer
*
* Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Moonlight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
*/
#include <pthread.h>
extern pthread_t main_thread_id;
void quit();

View File

@@ -18,7 +18,6 @@
*/
#include "../loop.h"
#include "../global.h"
#include "keyboard.h"
#include "mapping.h"

View File

@@ -19,7 +19,7 @@
#include "loop.h"
#include "global.h"
#include "connection.h"
#include <sys/stat.h>
#include <sys/signalfd.h>