From a8155b8bd45a4584cf024465e75331a29edda9b8 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 26 Apr 2017 14:06:21 +0000 Subject: Experiment, does this work? Still to be tested: Eliminate variable triggerPipeVal/eventFdVal (just use 'char dummy'), and just read/write 1 byte to triggerEventFd in stead of 8. Experiment failed: eventfd's always should be read/written 8 bytes. --- unix/tclEpollNotfy.c | 10 ++++------ unix/tclUnixNotfy.c | 4 +--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/unix/tclEpollNotfy.c b/unix/tclEpollNotfy.c index 5ed5d5d..ed947ab 100644 --- a/unix/tclEpollNotfy.c +++ b/unix/tclEpollNotfy.c @@ -747,20 +747,18 @@ Tcl_WaitForEvent( numFound = PlatformEventsWait(tsdPtr->readyEvents, tsdPtr->maxReadyEvents, timeoutPtr); for (numEvent = 0; numEvent < numFound; numEvent++) { + char dummy; pedPtr = tsdPtr->readyEvents[numEvent].data.ptr; filePtr = pedPtr->filePtr; mask = PlatformEventsTranslate(&tsdPtr->readyEvents[numEvent]); #ifdef HAVE_EVENTFD if (filePtr->fd == tsdPtr->triggerEventFd) { - uint64_t eventFdVal; - i = read(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)); - if ((i != sizeof(eventFdVal)) && (errno != EAGAIN)) { + i = read(tsdPtr->triggerEventFd, &dummy, 1); #else if (filePtr->fd == tsdPtr->triggerPipe[0]) { - char triggerPipeVal; - i = read(tsdPtr->triggerPipe[0], &triggerPipeVal, sizeof(triggerPipeVal)); - if ((i != sizeof(triggerPipeVal)) && (errno != EAGAIN)) { + i = read(tsdPtr->triggerPipe[0], &dummy, 1); #endif + if ((i != 1) && (errno != EAGAIN)) { Tcl_Panic("Tcl_WaitForEvent: " "read from %p->triggerEventFd: %s", (void *)tsdPtr, strerror(errno)); diff --git a/unix/tclUnixNotfy.c b/unix/tclUnixNotfy.c index 5bc753a..c6725c1 100644 --- a/unix/tclUnixNotfy.c +++ b/unix/tclUnixNotfy.c @@ -123,9 +123,7 @@ Tcl_AlertNotifier( #else ThreadSpecificData *tsdPtr = clientData; #if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) - uint64_t eventFdVal = 1; - if (write(tsdPtr->triggerEventFd, &eventFdVal, - sizeof(eventFdVal)) != sizeof(eventFdVal)) { + if (write(tsdPtr->triggerEventFd, "", 1) != 1) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", (void *)tsdPtr); #else -- cgit v0.12