首页> 中文期刊> 《计算机应用与软件》 >一种Linux系统下的线程通信方法

一种Linux系统下的线程通信方法

     

摘要

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.%提出一种结合数据和资源管理的线程通信方法,从数据结构上对消息进行定义和描述,并在此基础上设计和实现具备消息供给/回收策略的消息工厂.每个消息的内部会维护一个栈式数据结构,用于存放需要传递给其他线程的数据;然后基于POSIX消息队列实现用于传递消息的邮箱.发送线程从消息工厂取出一条消息并通过对数据栈进行压栈操作将待发送数据提交给消息,然后将消息邮递到邮箱里,接收线程从邮箱中取出消息并将数据依次从消息的数据栈中弹出,并在数据处理完成后将消息返还给消息工厂.

著录项

相似文献

  • 中文文献
  • 外文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号