This code snippet is nomore hanging. i did some mistake. but it's still the
same. not writing some data to the file. problem persists. whats still
going wrong please help.
[code]
QSemaphore mSemaphore1;
int nZ=1;
for (int z=0;z<nZ;z++)
{
Q_ASSERT( &mSemaphore1 );
Th = QtConcurrent::run(
this,&UNRSTParser::ProcessZLayer,z);
mSemaphore1.release(1);
values += (nX*nY);
}
mSemaphore1.acquire(nZ);
[/code]
On Fri, Oct 5, 2012 at 2:12 PM, Jan Kundrát <[email protected]> wrote:
> On 10/05/12 00:27, Sascha Cunz wrote:
> > But, after all, the above code is a so called busy-loop. It will eat up
> 1 core
> > almost completely (At least on most OS-configurations).
>
> Are you sure that a call to QFuture::waitForFinished() consumes CPU?
> That would be highly suspicious. Yes, the call will block and wait until
> the QFuture succeeds, but that's different from what a busy loop is.
>
> Using waitForFinished() on each future is easier and more
> straightforward than adding semaphores.
>
> With kind regards,
> Jan
>
> --
> Trojita, a fast e-mail client -- http://trojita.flaska.net/
> _______________________________________________
> Interest mailing list
> [email protected]
> http://lists.qt-project.org/mailman/listinfo/interest
>
--
Regards
Sujan Dasmahapatra
skype: sujan.dasmahapatra
yahoo msn : [email protected]
Mobile no : +966-530184511
--
Regards
Sujan Dasmahapatra
skype: sujan.dasmahapatra
yahoo msn : [email protected]
Mobile no : +966-530184511
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest