aboutsummaryrefslogtreecommitdiffstats
path: root/src/direct_bt
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-28 21:19:13 +0200
committerSven Gothel <[email protected]>2020-05-28 21:19:13 +0200
commit793d4a4ffffab6c1c51b4a78d3c3b13ba650f269 (patch)
tree0ff34de8afe5ee816ee905b785ab318c1c923353 /src/direct_bt
parentce8f940daa0f7b1c153e4a37f14293a094fb6009 (diff)
Use SIGALRM instead of SIGINT to interrupt system IO (for EINTR abort)
SIGINT signal handler blocks java ..
Diffstat (limited to 'src/direct_bt')
-rw-r--r--src/direct_bt/DBTManager.cpp12
-rw-r--r--src/direct_bt/GATTHandler.cpp4
-rw-r--r--src/direct_bt/HCIComm.cpp4
-rw-r--r--src/direct_bt/L2CAPComm.cpp2
4 files changed, 11 insertions, 11 deletions
diff --git a/src/direct_bt/DBTManager.cpp b/src/direct_bt/DBTManager.cpp
index 876ac7e2..9e27c3f7 100644
--- a/src/direct_bt/DBTManager.cpp
+++ b/src/direct_bt/DBTManager.cpp
@@ -134,19 +134,19 @@ static void mgmthandler_sigaction(int sig, siginfo_t *info, void *ucontext) {
DBTManager::pidSelf, pidMatch);
(void)ucontext;
- if( !pidMatch || SIGINT != sig ) {
+ if( !pidMatch || SIGALRM != sig ) {
return;
}
#if 0
// We do not de-install the handler on single use,
- // as we act for multiple SIGINT events within direct-bt
+ // as we act for multiple SIGALRM events within direct-bt
{
struct sigaction sa_setup;
bzero(&sa_setup, sizeof(sa_setup));
sa_setup.sa_handler = SIG_DFL;
sigemptyset(&(sa_setup.sa_mask));
sa_setup.sa_flags = 0;
- if( 0 != sigaction( SIGINT, &sa_setup, NULL ) ) {
+ if( 0 != sigaction( SIGALRM, &sa_setup, NULL ) ) {
ERR_PRINT("DBTManager.sigaction: Resetting sighandler");
}
}
@@ -250,7 +250,7 @@ DBTManager::DBTManager(const BTMode btMode)
sa_setup.sa_sigaction = mgmthandler_sigaction;
sigemptyset(&(sa_setup.sa_mask));
sa_setup.sa_flags = SA_SIGINFO;
- if( 0 != sigaction( SIGINT, &sa_setup, NULL ) ) {
+ if( 0 != sigaction( SIGALRM, &sa_setup, NULL ) ) {
ERR_PRINT("DBTManager::open: Setting sighandler");
}
}
@@ -392,7 +392,7 @@ void DBTManager::close() {
if( mgmtReaderRunning && mgmtReaderThread.joinable() ) {
mgmtReaderShallStop = true;
pthread_t tid = mgmtReaderThread.native_handle();
- pthread_kill(tid, SIGINT);
+ pthread_kill(tid, SIGALRM);
}
comm.close();
@@ -408,7 +408,7 @@ void DBTManager::close() {
sa_setup.sa_handler = SIG_DFL;
sigemptyset(&(sa_setup.sa_mask));
sa_setup.sa_flags = 0;
- if( 0 != sigaction( SIGINT, &sa_setup, NULL ) ) {
+ if( 0 != sigaction( SIGALRM, &sa_setup, NULL ) ) {
ERR_PRINT("DBTManager.sigaction: Resetting sighandler");
}
}
diff --git a/src/direct_bt/GATTHandler.cpp b/src/direct_bt/GATTHandler.cpp
index 36d61846..d12f5089 100644
--- a/src/direct_bt/GATTHandler.cpp
+++ b/src/direct_bt/GATTHandler.cpp
@@ -279,7 +279,7 @@ bool GATTHandler::connect() {
}
/**
- * We utilize DBTManager's mgmthandler_sigaction SIGINT handler,
+ * We utilize DBTManager's mgmthandler_sigaction SIGALRM handler,
* as we only can install one handler.
*/
std::thread l2capReaderThread = std::thread(&GATTHandler::l2capReaderThreadImpl, this);
@@ -314,7 +314,7 @@ bool GATTHandler::disconnect() {
if( l2capReaderRunning ) {
l2capReaderShallStop = true;
if( !is_l2capReader && 0 != tid_l2capReader ) {
- pthread_kill(tid_l2capReader, SIGINT);
+ pthread_kill(tid_l2capReader, SIGALRM);
}
}
diff --git a/src/direct_bt/HCIComm.cpp b/src/direct_bt/HCIComm.cpp
index 5e4f9cce..d82bba5e 100644
--- a/src/direct_bt/HCIComm.cpp
+++ b/src/direct_bt/HCIComm.cpp
@@ -204,7 +204,7 @@ int HCIComm::read(uint8_t* buffer, const int capacity, const int timeoutMS) {
#if 0
sigset_t sigmask;
sigemptyset(&sigmask);
- // sigaddset(&sigmask, SIGINT);
+ // sigaddset(&sigmask, SIGALRM);
struct timespec timeout_ts;
timeout_ts.tv_sec=0;
timeout_ts.tv_nsec=(long)timeoutMS*1000000L;
@@ -362,7 +362,7 @@ HCIErrorCode HCIComm::send_req(const uint16_t opcode, const void *command, const
#if 0
sigset_t sigmask;
sigemptyset(&sigmask);
- sigaddset(&sigmask, SIGINT);
+ sigaddset(&sigmask, SIGALRM);
struct timespec timeout_ts;
timeout_ts.tv_sec=0;
timeout_ts.tv_nsec=(long)_timeoutMS*1000000L;
diff --git a/src/direct_bt/L2CAPComm.cpp b/src/direct_bt/L2CAPComm.cpp
index bca64e53..b58ee536 100644
--- a/src/direct_bt/L2CAPComm.cpp
+++ b/src/direct_bt/L2CAPComm.cpp
@@ -192,7 +192,7 @@ bool L2CAPComm::disconnect() {
if( 0 != _tid_connect ) {
pthread_t tid_self = pthread_self();
if( tid_self != _tid_connect ) {
- pthread_kill(_tid_connect, SIGINT);
+ pthread_kill(_tid_connect, SIGALRM);
}
}