Merge branch 'master' into pico_sdk

This commit is contained in:
2026-08-11 09:56:27 +03:00
33 changed files with 749 additions and 405 deletions
+8 -7
View File
@@ -66,9 +66,9 @@ void PIWaitEvent::destroy() {
}
# else
for (int i = 0; i < 2; ++i) {
if (pipe_fd[i] != 0) {
if (pipe_fd[i] != -1) {
::close(pipe_fd[i]);
pipe_fd[i] = 0;
pipe_fd[i] = -1;
}
}
# endif
@@ -90,12 +90,13 @@ 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]));
int sr = ::select(nfds, &(fds[CheckRead]), &(fds[CheckWrite]), &(fds[CheckExeption]), nullptr);
int sr = ::select(nfds, &(fds[CheckRead]), &(fds[CheckWrite]), &(fds[CheckExeption]), nullptr);
if (sr < 0) return false;
errorClear();
int buf = 0;
while (::read(pipe_fd[ReadEnd], &buf, sizeof(buf)) > 0)
;
while (::read(pipe_fd[ReadEnd], &buf, sizeof(buf)) > 0) {}
// piCout << "wait result" << sr << FD_ISSET(fd, &(fds[CheckExeption])) << FD_ISSET(fd, &(fds[fd_index]));
if (sr == EBADF || sr == EINTR) return false;
if (errno == EBADF || errno == EINTR) return false;
if (FD_ISSET(fd, &(fds[CheckExeption]))) return true;
return FD_ISSET(fd, &(fds[fd_index]));
# endif
@@ -140,7 +141,7 @@ bool PIWaitEvent::isCreate() const {
# ifdef WINDOWS
return event;
# else
return pipe_fd[ReadEnd] != 0;
return pipe_fd[ReadEnd] != -1;
# endif
}