关于C++ 11中的条件变量有关问题,求神相肋

关于C++ 11中的条件变量问题,求神相肋啊
代码如下,我的目的很简单,就是开几个线程从一个全局的队列中取出来一个值打后打印,如果队列为空就用调用条件变量cv.writ方法等待,如果向队列中插一个值后就随便唤醒一个线程,可是按下面这样总是挂,为何啊,求大神

#include <iostream>
#include <thread>
#include <mutex>
#include <string>
#include <queue>
#include <condition_variable>
using namespace std;

mutex mtx;
condition_variable cv;
queue<string> qStr;

void print()
{
string str;
unique_lock<mutex> lck(mtx, defer_lock);

while(true)
{
lck.lock();
if (!qStr.empty())
{
str = qStr.front();
qStr.pop();
lck.unlock();

cout << str << endl;
}
else
{
lck.unlock();
cv.wait(lck);
}
}
}

int main()
{
vector<thread> vecThread;
for(int i = 0; i < 5; i++)
vecThread.emplace_back(thread(print));

long i = 0;
while(true)
{
getchar();
qStr.push(to_string(++i));
cv.notify_one();
}
}

------解决方案--------------------
条件变量没设置条件!
------解决方案--------------------
      else
        {
            lck.unlock();
            cv.wait(lck);
        }
    }

这个写法肯定不对的,只需要调一下wait就可以了。
------解决方案--------------------

#include "stdafx.h"
#include <iostream>
#include <thread>
#include <mutex>
#include <string>
#include <queue>
#include <condition_variable>
using namespace std;

mutex mtx;
condition_variable cv;
queue<string> qStr;

void print()
{
string str;

while(true)
{
unique_lock<mutex> lck(mtx);
while (qStr.empty()) {
cv.wait(lck);
}

str = qStr.front();
qStr.pop();
cout << str << endl;
}
}

int main()
{
vector<thread> vecThread;
for(int i = 0; i < 5; i++)
vecThread.emplace_back(thread(print));

long i = 0;
string temp;
while(true)
{
cin >> temp;
qStr.push(to_string(++i));
cv.notify_one();
}
}

------解决方案--------------------
vecThread.emplace_back(thread(print));

should be: vecThread.push_back(thread(print));

or: vecThread.emplace_back(print);

?