期刊文献+

一种Linux系统下的线程通信方法 被引量:2

A METHOD OF COMMUNICATION BETWEEN THREADS UNDER LINUX SYSTEM
下载PDF
导出
摘要 提出一种结合数据和资源管理的线程通信方法,从数据结构上对消息进行定义和描述,并在此基础上设计和实现具备消息供给/回收策略的消息工厂。每个消息的内部会维护一个栈式数据结构,用于存放需要传递给其他线程的数据;然后基于POSIX消息队列实现用于传递消息的邮箱。发送线程从消息工厂取出一条消息并通过对数据栈进行压栈操作将待发送数据提交给消息,然后将消息邮递到邮箱里,接收线程从邮箱中取出消息并将数据依次从消息的数据栈中弹出,并在数据处理完成后将消息返还给消息工厂。 A multi-thread communication method based on data and resource management is proposed. The concept of message is defined by a data structure,on the basis of which a message factory with supply/recycling strategy is designed and realized. First,each message maintained a stack of data structure,which was used to store the data that need to be passed to other threads. Afterwards,the mailbox based on POSIX message queue was implemented for passing messages.The sending thread took a message from the message factory and the data was submitted to the message by pushing onto a data stack. Then the message would be sent to a mailbox. The receiving thread fetched a message from the mailbox and popped the data sequentially from the message stack. At last the message would be returned to the message factory after the data had been processed.
作者 王天伟
出处 《计算机应用与软件》 2017年第10期330-333,共4页 Computer Applications and Software
关键词 多线程通信 消息工厂 邮箱 Multi-thread communication Message factory Mailbox
  • 相关文献

同被引文献13

引证文献2

二级引证文献2

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部