消费者生产者线程 [英] consumer producer threads

查看:117
本文介绍了消费者生产者线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个程序,该程序可以从用户那里获取任意数量的值,并将其保存在生产者部分的数组中.
然后,我需要将它们分成缓冲区(大小= 4)并将其发送给使用者.
那里我需要使用2个线程来获得上述值的总和.

I need to create a program that takes any number of values from user and keep it in a array at producer part.
Then i need to break those into buffers(size = 4)and send them to consumer.
there i need to get sum of above values using 2 threads.

推荐答案

忽略线程,您是否编写了任何基本代码,或者是否要求完整的代码?解决方案?
Ignoring the threads, have you written any of the basic code, or are you asking for a complete solution?


这篇关于消费者生产者线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆