简体   繁体   English

生产者消费者使用intel引脚内部线程

[英]Producer Consumer using intel-pin internal threads

I am trying to implement a producer consumer model to separate the analysis and recording the data (collected from analysis) part of my pin tool. 我试图实现生产者消费者模型以分离分析并记录我的pin工具的数据(从分析中收集)部分。 Going through the PIN thread API, I could not find any functions which can suspend a thread based on some predicate or signal a thread to resume (like pthread_cond_wait() and pthread_cond_signal() in POSIX threads). 通过PIN线程API,我找不到任何可以基于某些谓词挂起线程或向线程发出恢复信号的函数(例如POSIX线程中的pthread_cond_wait()pthread_cond_signal() )。 So, is there any workaround to achieve the producer consumer model using existing functions while avoiding busy-waiting. 因此,是否有任何变通办法可以使用现有功能来实现生产者消费者模型,同时又避免了繁忙等待。

NOTE: Both producer and consumer threads are internal threads created by PIN_SpawnInternalThread() . 注意:生产者线程和使用者线程都是PIN_SpawnInternalThread()创建的内部线程。

I recommend that you use the semaphore class provided in the Pin API. 我建议您使用Pin API中提供的信号量类。 You can find examples of producer/consumer solutions that make use of semaphores in Windows. 您可以找到在Windows中使用信号量的生产者/消费者解决方案的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM