Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » bug in CoWork since C++11
Re: bug in CoWork since C++11 [message #46763 is a reply to message #46686] Sat, 30 July 2016 18:36 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13980
Registered: November 2005
Ultimate Member
crydev wrote on Mon, 11 July 2016 19:36
I did some more debugging, and I found that it goes wrong in this function, in CoWork.cpp on line 196. It will wait infinitely until jobs are done, while there are still jobs to be done.

void CoWork::Finish() {
	if(!pool) return;
	Pool& p = *pool;
	p.lock.Enter();
	while(todo) {
		LLOG("Finish: todo: " << todo << " (CoWork " << FormatIntHex(this) << ")");
		if(todo == 0)
			break;
		if(p.scheduled)
			Pool::DoJob();
		else {
			p.lock.Leave();
			LLOG("WaitForFinish (CoWork " << FormatIntHex(this) << ")");
			waitforfinish.Wait(); // <---- Infinite wait here!
			p.lock.Enter();
		}
	}
	p.lock.Leave();
	LLOG("CoWork " << FormatIntHex(this) << " finished");
}


It is a very annoying bug. Sad

Thanks,

crydev


Sorry I have missed this important reply... Anyway, 2 things:

1. I have recently refactored CoWork to use ConditionVariable instead of Semaphore. There is a tiny chance that this alone will fix the issue.... (if there was a bug in CoWork).

2. You might try some logging... E.g. activate LLOG in CoWork

Is not it possible that some of thread is frozen because of some deadlock?

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how many threads should i use in SkyLark server?
Next Topic: WebSockets non blocking mode?
Goto Forum:
  


Current Time: Wed May 15 15:29:18 CEST 2024

Total time taken to generate the page: 0.01681 seconds