Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move some variable declarations closer to where they are used. No change in functionality. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tip-458 |
Files: | files | file ages | folders |
SHA1: |
cf831b219ff582fad4f45e43df47a2ab |
User & Date: | jan.nijtmans 2017-04-26 13:48:13 |
Context
2017-05-04
| ||
08:55 | merge trunk check-in: 9a065b2341 user: jan.nijtmans tags: tip-458 | |
2017-04-26
| ||
14:06 | Experiment, does this work? Still to be tested: Eliminate variable triggerPipeVal/eventFdVal (just u... Closed-Leaf check-in: 2d07e770af user: jan.nijtmans tags: tip-458-experiment | |
13:48 | Move some variable declarations closer to where they are used. No change in functionality. check-in: cf831b219f user: jan.nijtmans tags: tip-458 | |
2017-04-14
| ||
13:00 | merge trunk check-in: 242a7d68cd user: jan.nijtmans tags: tip-458 | |
Changes
Changes to unix/tclEpollNotfy.c.
︙ | ︙ | |||
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); FileHandler *filePtr; errno = pthread_mutex_init(&tsdPtr->notifierMutex, NULL); if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } #ifdef HAVE_EVENTFD if ((tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) <= 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger eventfd"); } #else if (pipe2(tsdPtr->triggerPipe, O_CLOEXEC | O_NONBLOCK) != 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger pipe"); } #endif if ((tsdPtr->eventsFd = epoll_create1(EPOLL_CLOEXEC)) == -1) { Tcl_Panic("epoll_create1: %s", strerror(errno)); } | > > > < < < < < < | 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); FileHandler *filePtr; errno = pthread_mutex_init(&tsdPtr->notifierMutex, NULL); if (errno) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create mutex"); } filePtr = ckalloc(sizeof(*filePtr)); #ifdef HAVE_EVENTFD if ((tsdPtr->triggerEventFd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK)) <= 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger eventfd"); } filePtr->fd = tsdPtr->triggerEventFd; #else if (pipe2(tsdPtr->triggerPipe, O_CLOEXEC | O_NONBLOCK) != 0) { Tcl_Panic("Tcl_InitNotifier: %s", "could not create trigger pipe"); } filePtr->fd = tsdPtr->triggerPipe[0]; #endif if ((tsdPtr->eventsFd = epoll_create1(EPOLL_CLOEXEC)) == -1) { Tcl_Panic("epoll_create1: %s", strerror(errno)); } filePtr->mask = TCL_READABLE; PlatformEventsControl(filePtr, tsdPtr, EPOLL_CTL_ADD, 1); if (!tsdPtr->readyEvents) { tsdPtr->maxReadyEvents = 512; tsdPtr->readyEvents = ckalloc(tsdPtr->maxReadyEvents * sizeof(tsdPtr->readyEvents[0])); } |
︙ | ︙ | |||
656 657 658 659 660 661 662 | struct timeval timeout, *timeoutPtr; int numFound, numEvent; struct PlatformEventData *pedPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int numQueued; ssize_t i; | < < < < < | 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | struct timeval timeout, *timeoutPtr; int numFound, numEvent; struct PlatformEventData *pedPtr; ThreadSpecificData *tsdPtr = TCL_TSD_INIT(&dataKey); int numQueued; ssize_t i; /* * Set up the timeout structure. Note that if there are no events to * check for, we return with a negative result rather than blocking * forever. */ |
︙ | ︙ | |||
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 | numFound = PlatformEventsWait(tsdPtr->readyEvents, tsdPtr->maxReadyEvents, timeoutPtr); for (numEvent = 0; numEvent < numFound; numEvent++) { pedPtr = tsdPtr->readyEvents[numEvent].data.ptr; filePtr = pedPtr->filePtr; mask = PlatformEventsTranslate(&tsdPtr->readyEvents[numEvent]); #ifdef HAVE_EVENTFD if (filePtr->fd == tsdPtr->triggerEventFd) { i = read(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)); if ((i != sizeof(eventFdVal)) && (errno != EAGAIN)) { #else if (filePtr->fd == tsdPtr->triggerPipe[0]) { i = read(tsdPtr->triggerPipe[0], &triggerPipeVal, sizeof(triggerPipeVal)); if ((i != sizeof(triggerPipeVal)) && (errno != EAGAIN)) { #endif Tcl_Panic("Tcl_WaitForEvent: " "read from %p->triggerEventFd: %s", (void *)tsdPtr, strerror(errno)); } else { | > > | 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 | numFound = PlatformEventsWait(tsdPtr->readyEvents, tsdPtr->maxReadyEvents, timeoutPtr); for (numEvent = 0; numEvent < numFound; numEvent++) { 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)) { #else if (filePtr->fd == tsdPtr->triggerPipe[0]) { char triggerPipeVal; i = read(tsdPtr->triggerPipe[0], &triggerPipeVal, sizeof(triggerPipeVal)); if ((i != sizeof(triggerPipeVal)) && (errno != EAGAIN)) { #endif Tcl_Panic("Tcl_WaitForEvent: " "read from %p->triggerEventFd: %s", (void *)tsdPtr, strerror(errno)); } else { |
︙ | ︙ |
Changes to unix/tclUnixNotfy.c.
︙ | ︙ | |||
98 99 100 101 102 103 104 | *---------------------------------------------------------------------- */ void Tcl_AlertNotifier( ClientData clientData) { | < < < < < | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | *---------------------------------------------------------------------- */ void Tcl_AlertNotifier( ClientData clientData) { if (tclNotifierHooks.alertNotifierProc) { tclNotifierHooks.alertNotifierProc(clientData); return; } else { #ifdef NOTIFIER_SELECT #ifdef TCL_THREADS ThreadSpecificData *tsdPtr = clientData; |
︙ | ︙ | |||
124 125 126 127 128 129 130 | pthread_cond_broadcast(&tsdPtr->waitCV); # endif /* __CYGWIN__ */ pthread_mutex_unlock(¬ifierMutex); #endif /* TCL_THREADS */ #else ThreadSpecificData *tsdPtr = clientData; #if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) | | | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | pthread_cond_broadcast(&tsdPtr->waitCV); # endif /* __CYGWIN__ */ pthread_mutex_unlock(¬ifierMutex); #endif /* TCL_THREADS */ #else ThreadSpecificData *tsdPtr = clientData; #if defined(NOTIFIER_EPOLL) && defined(HAVE_EVENTFD) uint64_t eventFdVal = 1; if (write(tsdPtr->triggerEventFd, &eventFdVal, sizeof(eventFdVal)) != sizeof(eventFdVal)) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerEventFd", (void *)tsdPtr); #else if (write(tsdPtr->triggerPipe[1], "", 1) != 1) { Tcl_Panic("Tcl_AlertNotifier: unable to write to %p->triggerPipe", |
︙ | ︙ |