Exemplo n.º 1
0
void VMSocket::writableSlot(int socket) {
    writeNotifier->setEnabled(false);

    /* Make an up-call to unblock the thread */
    NotifySocketStatusChanged((long)this, SD_SEND);
 
    (void)socket; // avoid a compiler warning
}
/**
 * See pcsl_network_na.h for definition.
 */
void na_destroy(void *handle) {
    if (handle != NULL) {
        SocketHandle *sh = SOCKET_HANDLE(handle);
        removeSocketHandle(SOCKET_HANDLE(handle));

        /* Still registered readers/writers should be unblocked */
        if (sh->check_flags != 0) {
            sh->status = PCSL_NET_INTERRUPTED;
            if (sh->check_flags & CHECK_READ) {
                NotifySocketStatusChanged((long)handle, SD_RECV);
            }
            if (sh->check_flags & CHECK_WRITE) {
                NotifySocketStatusChanged((long)handle, SD_SEND);
            }
        }
        /* It's up to caller to guarantee this handle will be used no more */
        pcsl_mem_free(handle);
    }
}
Exemplo n.º 3
0
/**
 * See pcsl_network_na.h for definition.
 */
void na_destroy(void *handle) {

    /*
     * Throw an interrupted IO Exception if this socket is already blocked
     * for read or write operation by any other thread
     */
    if (((VMSocket*)handle)->readerCount > 0) {
        setVMSocketHandleStatus(handle, SOCKET_STATUS_INTERRUPTED);
        /* Make an up-call to unblock the thread */
        NotifySocketStatusChanged((long)handle, SD_RECV);
    }
    if (((VMSocket*)handle)->writerCount > 0) {
        setVMSocketHandleStatus(handle, SOCKET_STATUS_INTERRUPTED);
        /* Make an up-call to unblock the thread */
        NotifySocketStatusChanged((long)handle, SD_SEND);
    }

    destroySocketHandle(handle);
}