Changeset 13663 in vbox
- Timestamp:
- Oct 29, 2008 4:02:21 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 38606
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Serial/DrvHostSerial.cpp
r12892 r13663 34 34 #include <iprt/asm.h> 35 35 #include <iprt/assert.h> 36 #include <iprt/stream.h>37 36 #include <iprt/semaphore.h> 38 37 #include <iprt/file.h> … … 53 52 # include <sys/ioctl.h> 54 53 # include <pthread.h> 55 # include <sys/signal.h>56 54 57 55 # ifdef RT_OS_LINUX … … 1011 1009 } 1012 1010 1013 # ifdef RT_OS_LINUX1014 /** Signal handler for SIGUSR2.1015 * Used to interrupt ioctl(TIOCMIWAIT). */1016 static void drvHostSerialSignalHandler(int iSignal)1017 {1018 /* Do nothing. */1019 return;1020 }1021 # endif /* RT_OS_LINUX */1022 1023 1011 /** 1024 1012 * Unblock the monitor thread so it can respond to a state change. … … 1056 1044 * 3. The second approach doesn't work too, the ioctl doesn't return. 1057 1045 * But it seems that the ioctl is interruptible (return code in errno is EINTR). 1058 * We get the native thread id of the PDM thread and send a signal with pthread_kill().1059 1046 */ 1060 1047 … … 1115 1102 # endif 1116 1103 1117 pthread_t ThreadId = (pthread_t)RTThreadGetNative(pThread->Thread); 1118 struct sigaction SigactionThread; 1119 struct sigaction SigactionThreadOld; 1120 1121 memset(&SigactionThread, 0, sizeof(struct sigaction)); 1122 sigemptyset(&SigactionThread.sa_mask); 1123 SigactionThread.sa_flags = 0; 1124 SigactionThread.sa_handler = drvHostSerialSignalHandler; 1125 rc = sigaction(SIGUSR2, &SigactionThread, &SigactionThreadOld); 1126 if (rc < 0) 1104 rc = RTThreadPoke(pThread->Thread); 1105 if (RT_FAILURE(rc)) 1127 1106 PDMDrvHlpVMSetRuntimeError(pDrvIns, false, "DrvHostSerialFail", 1128 N_("Suspending serial monitor thread failed for serial device '%s' (%Vrc). The shutdown may take extremly long"), 1129 pThis->pszDevicePath, RTErrConvertFromErrno(errno)); 1130 1131 rc = pthread_kill(ThreadId, SIGUSR2); 1132 if (rc < 0) 1133 PDMDrvHlpVMSetRuntimeError(pDrvIns, false, "DrvHostSerialFail", 1134 N_("Suspending serial monitor thread failed for serial device '%s' (%Vrc). The shutdown may take extremly long"), 1107 N_("Suspending serial monitor thread failed for serial device '%s' (%Vrc). The shutdown may take longer than expected"), 1135 1108 pThis->pszDevicePath, RTErrConvertFromErrno(rc)); 1136 1109 1137 /* Restore old action handler. */1138 sigaction(SIGUSR2, &SigactionThreadOld, NULL);1139 1140 1110 # else /* !RT_OS_LINUX*/ 1111 1141 1112 /* In polling mode there is nobody to wake up (PDMThread will cancel the sleep). */ 1142 1113 NOREF(pDrvIns);
Note:
See TracChangeset
for help on using the changeset viewer.