⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 synsyncrecvthr.c

📁 linux环境下用纯c写的RTP协议的通用开发库
💻 C
字号:
/*------------------------------------------------------------------------- * synsyncrecvthr.c - synsyncrecvthr *------------------------------------------------------------------------- */#include <syn.h>#include <signal.h>#include <pthread.h>#include <util.h>#include <stdio.h>#ifdef RTPLIB_SYNCHRONIZE/*----------------------------------------------------------------------- * synsyncrecvthr - loop, processing incoming synch requests from other * synchronization sessions. Synchronization is currently experimental * and not well-tested. *----------------------------------------------------------------------- */voidsynsyncrecvthr(struct synsession *pssn){	fd_set	fds;	int                   i;	/*	 * Initialize by setting signal handler, then signal condition to	 * indicate that initialization is complete. This code prevents	 * rtpctl from sending a SIGTERM *before* the handler is installed.	 */	pthread_mutex_lock(&pssn->ssn_recvthrmutex);  	signal(SIGHUP, nullfcn);	pssn->ssn_recvthrstat = THR_RUNNING;	pthread_cond_signal(&pssn->ssn_cond);  	pthread_mutex_unlock(&pssn->ssn_recvthrmutex);	while(TRUE) {		FD_ZERO(&fds);		/*		 * Build FD set.		 */		for(i = 0; i < SYN_FDCNT; i++)			if (pssn->ssn_syncfds[i] != 0)				FD_SET(pssn->ssn_syncfds[i], &fds);		/*		 * Select on FD set.		 */		select(256, &fds, NULL, NULL, NULL);		/*		 * Acknowledge SIGTERM and exit.		 */		pthread_mutex_lock(&pssn->ssn_recvthrmutex);		if (pssn->ssn_recvthrstat == THR_TERMINATE) {			pssn->ssn_recvthrstat = THR_NOTRUNNING;			pthread_cond_signal(&pssn->ssn_cond);			pthread_mutex_unlock(&pssn->ssn_recvthrmutex);			return;		}		pthread_mutex_unlock(&pssn->ssn_recvthrmutex);		for (i = 0; i < SYN_FDCNT; i++)			if (FD_ISSET(pssn->ssn_syncfds[i], &fds))				synsyncrecv(pssn, pssn->ssn_syncfds[i]);    	} /* while */}#endif /* RTPLIB_SYNCHRONIZE */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -