Ejemplo n.º 1
0
INT main(INT iArgc, CHAR *pcArgv[])
{
    ULONG ulRet = ERROR_SUCCESS;
    INT iRcvFd = INVALID_FD;
    INT iSndFd = INVALID_FD;
    EV_HANDLE hEv;

    g_pcProgramName = pcArgv[0];

    /* ½âÎö²ÎÊý */
    ulRet = parseParamter(iArgc, pcArgv);
    if (ERROR_SUCCESS != ulRet)
    {
        usage();
        return 1;
    }

    hEv = ev_create();
    if (EV_INVALID_HANDLE == hEv)
    {
        printf("Failed to create ev.\n");
        return ERROR_FAILED;
    }

    iSndFd = openSndFd();
    if (INVALID_FD == iSndFd)
    {
        printf("Failed to open send fd.\n");
        ev_destroy(hEv);
        return 1;
    }

    iRcvFd = UDP_CreateServer(inet_addr("0.0.0.0"), g_usLocalPort);
    if (INVALID_FD == iRcvFd)
    {
        printf("Failed to open receive fd.\n");
        close(iSndFd);
        ev_destroy(hEv);
        return 1;
    }
    printf("Open receive UDP fd at %s:%hu\n", "0.0.0.0", g_usLocalPort);

    ulRet = ev_addfd(hEv, iRcvFd, EV_READ, fdEvProcCB, (VOID *)(ULONG)iSndFd);
    if (ERROR_SUCCESS != ulRet)
    {
        close(iSndFd);
        close(iRcvFd);
        ev_destroy(hEv);
        return ERROR_FAILED;
    }

    EV_RUN(hEv, 0);

    close(iSndFd);
    close(iRcvFd);
    ev_destroy(hEv);

    return 0;
}
Ejemplo n.º 2
0
int dds_cond_destroy (cond_t *cv)
{
	ev_destroy (cv->waiters_done);
	lock_destroy (cv->waiters_lock);
	sema_destroy (cv->sema);
	return (DDS_RETCODE_OK);
}
Ejemplo n.º 3
0
Archivo: ev.c Proyecto: eniu9350/sm_sim
int ev_list_remove(ev_list* l, int i)
{
	int result;
	ev* e;
	result = 0;
	e = ev_list_remove_without_destroy(l, i, &result);//mmm: [Clang] result used directly?
	if(result == 0)	{
		ev_destroy(e);
	}
	return result;
}