version 3.6.0

another fixes in PIEthernet
remove PIThread::interrupt()
piwaitevent patches
This commit is contained in:
2022-11-12 13:31:26 +03:00
parent 7bbffef237
commit e9128771db
11 changed files with 57 additions and 90 deletions

View File

@@ -248,10 +248,6 @@
typedef long time_t;
#endif
#ifdef POSIX_SIGNALS
# define PIP_INTERRUPT_SIGNAL SIGTERM
#endif
#ifdef LINUX
# define environ __environ
#endif

View File

@@ -92,24 +92,6 @@ void __sighandler__(PISignals::Signal s) {
}
#ifdef POSIX_SIGNALS
void pipThreadSignalHandler(int sig) {
//# ifdef ANDROID
// pthread_exit(0);
//# endif
}
void pipInitThreadSignals() {
struct sigaction actions;
memset(&actions, 0, sizeof(actions));
sigemptyset(&actions.sa_mask);
actions.sa_flags = 0;
actions.sa_handler = pipThreadSignalHandler;
if (sigaction(PIP_INTERRUPT_SIGNAL, &actions, 0) != 0)
piCout << "sigaction error:" << errorString();
}
#endif
PIInit::PIInit() {
file_charset = 0;
PISystemInfo * sinfo = PISystemInfo::instance();
@@ -178,9 +160,6 @@ PIInit::PIInit() {
setlocale(LC_NUMERIC, "C");
# endif //HAS_LOCALE
#endif //ANDROID
#ifdef POSIX_SIGNALS
pipInitThreadSignals();
#endif
PRIVATE->delete_locs = false;
__syslocname__ = __sysoemname__ = 0;
__utf8name__ = const_cast<char*>("UTF-8");

View File

@@ -85,10 +85,12 @@ bool PIWaitEvent::wait(int fd, CheckRole role) {
FD_SET(pipe_fd[ReadEnd], &(fds[CheckRead]));
FD_SET(fd, &(fds[CheckExeption]));
if (fd_index != CheckExeption) FD_SET(fd, &(fds[fd_index]));
::select(nfds, &(fds[CheckRead]), &(fds[CheckWrite]), &(fds[CheckExeption]), nullptr);
int sr = ::select(nfds, &(fds[CheckRead]), &(fds[CheckWrite]), &(fds[CheckExeption]), nullptr);
int buf = 0;
while (::read(pipe_fd[ReadEnd], &buf, sizeof(buf)) > 0);
if (FD_ISSET(fd, &(fds[CheckExeption]))) return false;
//piCout << "wait result" << sr << FD_ISSET(fd, &(fds[CheckExeption])) << FD_ISSET(fd, &(fds[fd_index]));
if (sr == EBADF || sr == EINTR) return false;
if (FD_ISSET(fd, &(fds[CheckExeption]))) return true;
return FD_ISSET(fd, &(fds[fd_index]));
#endif
return true;