1

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. 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). 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().

UmNyobe
  • 22,539
  • 9
  • 61
  • 90
Genesis
  • 11
  • 1
  • Not sure about how to handle internal PIN threads in a prod/cons way, but did you tried to use the [Fast buffered API](https://software.intel.com/sites/landingpage/pintool/docs/71313/Pin/html/group__BUFFER__API.html)? – Neitsa Jun 11 '15 at 17:40

1 Answers1

0

I recommend that you use the semaphore class provided in the Pin API. You can find examples of producer/consumer solutions that make use of semaphores in Windows.

nitzanms
  • 1,786
  • 12
  • 35