On 09/25/2012 05:45 PM, Christoffer Pettersson wrote:
The cin in the render thread is not supposed to be there. They were just put
there to see if they would block or not, which they did. The problem i have is
that if i write cin in any other thread than the render thread, then the thread
containing the cin command does not block. It jumps over the cin command giving
me an empty buffer. This happens on 1 out of the 3 computers i have tested the
code on. On the other 2, the cin command succesfully blocks.
Ah, OK, now I understand the problem. Thanks :-)
Not sure about your case, but usually when std::cin doesn't block, it
means that there's something left to be read from the stream. What
happens if you switch to using std::getline() instead? You can then
process the entire line of input using a stringstream, and there's no
chance a stray \n will get stuck in the stream. It's usually better to
process console input in a line-oriented way.
Take a look at this question on Stack Overflow:
http://stackoverflow.com/questions/11354936/why-doesnt-stdgetline-block
--"J"
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org