Home | History | Annotate | Download | only in os

Lines Matching refs:_index

105 static inline BOOL cancel_io(int _index)
107 if ((_index < 0) || (_index >= MAX_FDS)) {
111 if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
112 || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
115 if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
117 (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
121 return (*pCancelIoEx)(poll_fd[_index].handle, poll_fd[_index].overlapped);
123 if (_poll_fd[_index].thread_id == GetCurrentThreadId()) {
124 return CancelIo(poll_fd[_index].handle);
137 static __inline BOOL cancel_io(int _index)
139 if ((_index < 0) || (_index >= MAX_FDS)) {
142 if ( (poll_fd[_index].fd < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
143 || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL) ) {
146 if (poll_fd[_index].itransfer && poll_fd[_index].cancel_fn) {
148 (*poll_fd[_index].cancel_fn)(poll_fd[_index].itransfer);
387 static void _free_index(int _index)
390 cancel_io(_index);
393 if (_poll_fd[_index].original_handle != INVALID_HANDLE_VALUE) {
394 CloseHandle(poll_fd[_index].handle);
396 _poll_fd[_index].original_handle = INVALID_HANDLE_VALUE;
397 _poll_fd[_index].thread_id = 0;
399 free_overlapped(poll_fd[_index].overlapped);
400 poll_fd[_index] = INVALID_WINFD;
410 int _index;
414 _index = _fd_to_index_and_lock(wfd->fd);
415 if (_index < 0) {
418 _free_index(_index);
420 LeaveCriticalSection(&_poll_fd[_index].mutex);
512 int _index, object_index, triggered;
541 _index = _fd_to_index_and_lock(fds[i].fd);
542 poll_dbg("fd[%d]=%d: (overlapped=%p) got events %04X", i, poll_fd[_index].fd, poll_fd[_index].overlapped, fds[i].events);
544 if ( (_index < 0) || (poll_fd[_index].handle == INVALID_HANDLE_VALUE)
545 || (poll_fd[_index].handle == 0) || (poll_fd[_index].overlapped == NULL)) {
548 if (_index >= 0) {
549 LeaveCriticalSection(&_poll_fd[_index].mutex);
557 if ((fds[i].events & POLLIN) && (poll_fd[_index].rw != RW_READ)) {
561 LeaveCriticalSection(&_poll_fd[_index].mutex);
566 if ((fds[i].events & POLLOUT) && (poll_fd[_index].rw != RW_WRITE)) {
570 LeaveCriticalSection(&_poll_fd[_index].mutex);
576 if ( (HasOverlappedIoCompleted(poll_fd[_index
577 || (HasOverlappedIoCompletedSync(poll_fd[_index].overlapped)) ) {
583 handles_to_wait_on[nb_handles_to_wait_on] = poll_fd[_index].overlapped->hEvent;
587 LeaveCriticalSection(&_poll_fd[_index].mutex);
603 _index = _fd_to_index_and_lock(fds[i].fd);
606 if (_index >= 0) {
607 LeaveCriticalSection(&_poll_fd[_index].mutex);
633 int _index;
638 _index = _fd_to_index_and_lock(fd);
640 if (_index < 0) {
643 free_overlapped(poll_fd[_index].overlapped);
644 poll_fd[_index] = INVALID_WINFD;
645 LeaveCriticalSection(&_poll_fd[_index].mutex);
655 int _index;
665 _index = _fd_to_index_and_lock(fd);
667 if ( (_index < 0) || (poll_fd[_index].overlapped == NULL) ) {
669 if (_index >= 0) {
670 LeaveCriticalSection(&_poll_fd[_index].mutex);
675 poll_dbg("set pipe event (fd = %d, thread = %08X)", _index, (unsigned int)GetCurrentThreadId());
676 SetEvent(poll_fd[_index].overlapped->hEvent);
677 poll_fd[_index].overlapped->Internal = STATUS_WAIT_0;
680 poll_fd[_index].overlapped->InternalHigh++;
682 LeaveCriticalSection(&_poll_fd[_index].mutex);
691 int _index;
702 _index = _fd_to_index_and_lock(fd);
704 if (_index < 0) {
709 if (WaitForSingleObject(poll_fd[_index].overlapped->hEvent, INFINITE) != WAIT_OBJECT_0) {
715 poll_dbg("clr pipe event (fd = %d, thread = %08X)", _index, (unsigned int)GetCurrentThreadId());
716 poll_fd[_index].overlapped->InternalHigh--;
718 if (poll_fd[_index].overlapped->InternalHigh <= 0) {
719 ResetEvent(poll_fd[_index].overlapped->hEvent);
720 poll_fd[_index].overlapped->Internal = STATUS_PENDING;
726 LeaveCriticalSection(&_poll_fd[_index].mutex);