怎样将图形和c语言代码链接,急求下面关于C的代码的意思,可以把它画成流程图...

void *AcceptProc(void *pCtl)

{

int nIndex;

int *pnCtl = NULL;

int nNewFd;

int nSizeOfAddr,nFlags = 0;

DEVICEINFO st_DeviceInfo;

struct sockaddr_in stSocketAddrClient;

nSizeOfAddr = sizeof(struct sockaddr);

pthread_detach(pthread_self());

pnCtl = (int *)pCtl;

WRITE_INFO_LOG("dmp_recv","0302010001-I","AcceptProc:"

"a new AcceptProc is create");

while (1)

{

//for thread pool mgr ,if task become litter

//pnCtl will be set with THREAD_OUT.then ,this thread should exit

if(*pnCtl == THREAD_OUT)

{

WRITE_INFO_LOG("dmp_recv","0302010002-I","AcceptProc:"

"one AcceptProc is exit");

pthread_exit(NULL);

}

pthread_mutex_lock(&g_st_canAccept.locker);

pthread_cond_wait(&g_st_canAccept.startAble, &g_st_canAccept.locker);

pthread_mutex_unlock(&g_st_canAccept.locker);

//if chang this to while(1) ,do we need pthread_cond_wait anymore?

//Can we delete the three code now?

while(1)

{

//accep is a BLOCK operate

if((nNewFd = accept(g_nListenfd, (struct sockaddr *)&stSocketAddrClient, (socklen_t *)&nSizeOfAddr)) != -1)

{

if(nNewFd<=0)

{

WRITE_ERROR_LOG("dmp_recv","0302010003-E","AcceptProc:"

"new socket fd is not more than 0");

continue;

}

//nCountAccept++;

if(fcntl(nNewFd, F_SETFL, O_NONBLOCK) != 0 )

{

WRITE_ERROR_LOG("dmp_recv","0302010004-E","AcceptProc:"

"func error in fcntl");

WRITE_ERROR_LOG_EX("dmp_recv","0302010004-E-%d",nNewFd);

CloseFileDesc(nNewFd);

continue;

}

st_DeviceInfo.nType = nDeviceType;

st_DeviceInfo.nSocketId = nNewFd;

//  modify by yexiaoyu start

//nFlags = EPOLLIN;

nFlags = EPOLLIN | EPOLLET;

//  modify by yexiaoyu end

if(AddEventToEpoll(&st_DeviceInfo,nFlags) != 0)

{

WRITE_ERROR_LOG("dmp_recv","0302010005-E","AcceptProc:"

"func error in AddEventToEpoll");

CloseFileDesc(nNewFd);

continue;

}

nCountAccept++;

}

else

{

AcceptErrorInfo();

WRITE_ERROR_LOG("dmp_recv","0302010006-E","AcceptProc:"

"func error in accept");

}

}

}

pthread_exit(NULL);

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值