📄 pipe_out.c.svn-base
字号:
#include <stdio.h>#include <assert.h>#include <stdlib.h>#include <string.h>#include <fcntl.h>#include <sys/types.h>#include <sys/uio.h>#include <unistd.h>#include "pipe_out_pub.h"#include "xwin_pub.h"#include "player_pub.h"pipe_out_t *pipe_out_new(player_t *player_p) { pipe_out_t *pipe_out_p = g_new(pipe_out_t,1); pipe_out_p->player_p = player_p; pthread_mutex_init(&player_p->urlq_mutex , NULL); pthread_cond_init(&player_p->urlq_cond , NULL); return pipe_out_p;}void pipe_out_run(pipe_out_t *pipe_out_p) { int fd; char *dq; char name[32]; char value[1024]; char tmpstr[1024]; int i; int err; GSList *p; player_t *player_p = pipe_out_p->player_p; fd=open(player_p->pipe_out_filename_p,O_NONBLOCK|O_WRONLY); fcntl(fd,F_SETFL,(fcntl(fd,F_GETFL,0)&(~O_NONBLOCK))); assert( fd > 0 ); while(1) { assert(pthread_mutex_lock(&player_p->urlq_mutex)==0); assert(pthread_cond_wait(&player_p->urlq_cond,&player_p->urlq_mutex)==0); if (player_p->urlq_p) { write(fd,(char*)player_p->urlq_p->data,strlen((char*)player_p->urlq_p->data)); write(fd,";\n",2); p = player_p->urlq_p; player_p->urlq_p = g_slist_remove_link(player_p->urlq_p,p); g_free(p->data); g_slist_free_1(p); }; assert(pthread_mutex_unlock(&player_p->urlq_mutex)==0); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -