title: Block Go routine in a shared library
body: <p>I have shared library which provides a function that will go to waiting state during processing.  The waiting is achieved by the condition variable provided by c++. Any one knows how to call this function correctly from Go?</p>
  
  <p>C++ functions:</p>
  
  <p>I have a queue to store all the tasks to be processed. </p>
  
  <pre><code>queue&lt;Task&gt; tasks;
  Mutex mutex;
  condition_variable cv;
  
  void process(string img_path) {
      std::unique_lock&lt;Mutex&gt; lock(mutex);
      Task task(img_path);
      tasks.push_back(task);
      cv.wait(); //wait the task to be processed, because i have to process the tasks in a batch way using GPU
  }
  </code></pre>
  
  <p>The above code is just used to illustrate the key component which is the blocking wait function of condition variable.  It will be compiled into a dynamic library.   If called from Python, I found a solution illustrated in <a href="https://docs.python.org/2.7/c-api/init.html#thread-state-and-the-global-interpreter-lock" rel="nofollow">here</a>. Any one knows how to call from Golang?</p>