线程同步问题 [英] Threads synchronization problem
问题描述
我正在为分布式旅行锦标赛问题解决方案编写代码.
我有:
1.将线程分配给客户端的多线程服务器
2.要求客户端完成作业并将数据返回到服务器.
3.服务器线程应该等待从各个客户端收集数据,然后恢复执行,计算结果然后终止.
我的问题:
我使用了加入和同步功能,但没有帮助.我正在寻找类似工作线程的东西
希望您能解决我的问题,因为我是新手.
I am writing a code for distributed Traveling Tournament Problem Solution.
I have:
1.Multithreaded server which allocates chromosomes to the clients
2.Clients are required to completed the job and return the data to the server.
3. The server thread is supposed to wait for the data to be collected from various clients, and then resume it''s execution, calculate the result and then terminate.
My problem:
I used join and synchronize but no help. I am looking something like worker threads
I hope you get my problem as I am a newbie.
推荐答案
首先,请通过 ^ ],因为它涵盖了您感兴趣的大部分内容.
尝试使用wait
和notify
结构,而不是使用join.
仅供参考,如果您尝试发布,则会获得更多帮助.
Firstly, go through this[^] as it covers most of what you are interested in.
Instead of using join, try await
andnotify
structure.
FYI, if you''d posted an attempt, you''d have got more help.
这篇关于线程同步问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!