文件名称:thread
介绍说明--下载内容均来自于网络,请自行研究使用
thrs_data结构中的几个变量用于读数据线程和显示线程的开始控制和结束控制。start_read:当二个线程同时启动或显示线程先启动时,保证读数据线程先使用缓冲区,=1表示读数据线程已使用了缓冲区;start_disp:在读数据线程对缓冲区进行第一轮操作时,当它已将2个缓冲区写满,而此时显示线程还没有启动或还没有使用过缓冲区,这时应将读数据线程阻塞住,防止它覆盖掉缓冲区中未显示的数据,=1表示显示线程已启动并已使用了缓冲区。在后续交替读数据和显示数据的过程中,由互斥锁来协调二个线程之间的关系。Flag:用于标识数据的结束,=1表示在缓冲区1上结束,=2表示在缓冲区2上结束。-Thrs_data structure of threads and several variable is used to read data to indicate the start of the thread control and end control.Start_read: when two threads start or display threads first start at the same time, ensure that read data line Mr. Cheng using buffer, = 1 said thread to read data have been used the buffer Start_disp: reading data thread on buffer for the first round of the operation, when it will have two buffer write full, while the thread has not been started or haven t used the buffer, then it should be a thread to read data block, prevent it covers off not shown in the buffer data, said = 1 shows that the thread has started and has used the buffer.In the subsequent alternate read data and display the data in the process, by the mutex to coordinate the relationship between the two threads.Flag: used to identify the end of the data, said = 1 at the end of the buffer 1, 2 = said at the end of the buffer zone 2.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
thread.cpp