1.
进程接收到信号以后,可以有如下3种选择进行处理:
SIGKILL
2. 多线程
pthread_create()
pthread_join()
pthread_exit()
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_unlock()
pthread_mutex_destory
pthread_self( )
pthread_detach( )
条件变量:
pthread_cond_wait()
pthread_cond_signal()
pthread_cond_broadcast()
pthread_cond_init()
pthread_cond_destory()
任务1: 创建线程,实现多窗口卖票;
任务2: 客户端,服务器, 客户端放送信息给服务器,客户端的信息由 服务器中的线程进行处理,处理完后返回给客户端;
服务器一条总管道,这条管道只接收客户端的上线信息;
客户端的发送信息,接收信息管道均由客户端创建,注意创建管道要放前面。(当在管道创建之前去打开管道的话open()函数会返回-1 )
服务器运用select()函数轮询 信号,与服务器建立联系的客户端连接成一个链表,并将客户端相应的描述符加入select 中,当客户端退出时删除链表中的结点,并且将select中的描述符删除;
服务器接收到的信息任务放在一个消息队列中,子线程互斥的从队列中取任务处理,返回给客户端。
任务2详情见 0826代码;