From Elvin and Philippe:
From Elvin and Philippe:

In TJoinHelper::Join check the predicate value (fJoined) both when the TimedWaited return due to a timeout or due to receiving the signal
and unconditionally breakout in case of errors.

Elvin tracked down the issue. Basically, there is a deadlock in the TJoinHelper::Join method. 

The problem is when the helper thread tries to signal the main thread then the join is done. This is achieved by using the conditional variable fC. But, it can be that the helper thread gets the lock in the TJoinHelper::JoinFunc method around line 117 and the requesting threads tries to wait in line 136 but the time-out expires before the helper thread sends the signal and releases the lock ( one can easily reproduce this by adding a sleep(3) after lline 117). So, now the requesting thread is blocked waiting to get the lock for the mutex. Say now that the helper thread sends the signal and releases the lock. The signal is lost as the requesting thread was not not in the TimedWait and the helper threads exits. Therefore. we end up in a situation that there is no one to send the signal to the requesting tread that the join was done properly.

The simple change that I've done is line 148:

if (fJoined) break;

Because is doesn't matter that much if we received the signal or not as long as the join was done properly. Also notice that this test is done while the mutex is held by the requesting thread so there is no danger of any race conditions.


git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@45617 27541ba8-7e3a-0410-8455-c3a389f83636

sirinath/root,esakellari/root,zzxuanyuan/root-compressor-dummy,mattkretz/root,evgeny-boger/root,sirinath/root,sirinath/root,arch1tect0r/root,davidlt/root,pspe/root,arch1tect0r/root,smarinac/root,pspe/root,BerserkerTroll/root,sbinet/cxx-root,cxx-hep/root-cern,thomaskeck/root,mhuwiler/rootauto,root-mirror/root,arch1tect0r/root,thomaskeck/root,beniz/root,bbockelm/root,sawenzel/root,karies/root,Duraznos/root,nilqed/root,bbockelm/root,jrtomps/root,satyarth934/root,thomaskeck/root,mattkretz/root,veprbl/root,sirinath/root,karies/root,lgiommi/root,mhuwiler/rootauto,sbinet/cxx-root,davidlt/root,jrtomps/root,sirinath/root,bbockelm/root,agarciamontoro/root,lgiommi/root,sawenzel/root,olifre/root,mhuwiler/rootauto,perovic/root,simonpf/root,omazapa/root-old,sirinath/root,olifre/root,mkret2/root,thomaskeck/root,smarinac/root,thomaskeck/root,veprbl/root,veprbl/root,BerserkerTroll/root,zzxuanyuan/root,agarciamontoro/root,dfunke/root,esakellari/root,esakellari/root,cxx-hep/root-cern,dfunke/root,beniz/root,mhuwiler/rootauto,olifre/root,davidlt/root,bbockelm/root,lgiommi/root,omazapa/root,nilqed/root,mhuwiler/rootauto,sirinath/root,olifre/root,Y--/root,zzxuanyuan/root,lgiommi/root,cxx-hep/root-cern,mattkretz/root,sbinet/cxx-root,Y--/root,mattkretz/root,davidlt/root,vukasinmilosevic/root,davidlt/root,veprbl/root,sawenzel/root,dfunke/root,krafczyk/root,zzxuanyuan/root-compressor-dummy,krafczyk/root,mhuwiler/rootauto,nilqed/root,zzxuanyuan/root,lgiommi/root,Y--/root,sirinath/root,simonpf/root,cxx-hep/root-cern,esakellari/my_root_for_test,BerserkerTroll/root,perovic/root,root-mirror/root,Duraznos/root,gganis/root,sawenzel/root,zzxuanyuan/root,lgiommi/root,simonpf/root,mhuwiler/rootauto,Y--/root,root-mirror/root,CristinaCristescu/root,arch1tect0r/root,agarciamontoro/root,nilqed/root,karies/root,gganis/root,perovic/root,mhuwiler/rootauto,satyarth934/root,dfunke/root,georgtroska/root,satyarth934/root,smarinac/root,nilqed/root,evgeny-boger/root,georgtroska/root,satyarth934/root,lgiommi/root,mkret2/root,evgeny-boger/root,lgiommi/root,lgiommi/root,sawenzel/root,pspe/root,gbitzes/root,simonpf/root,beniz/root,thomaskeck/root,buuck/root,gganis/root,esakellari/my_root_for_test,agarciamontoro/root,gbitzes/root,omazapa/root-old,omazapa/root,BerserkerTroll/root,sbinet/cxx-root,jrtomps/root,mattkretz/root,lgiommi/root,zzxuanyuan/root,zzxuanyuan/root,davidlt/root,karies/root,dfunke/root,CristinaCristescu/root,Y--/root,georgtroska/root,gbitzes/root,perovic/root,evgeny-boger/root,smarinac/root,davidlt/root,cxx-hep/root-cern,beniz/root,gbitzes/root,sawenzel/root,gbitzes/root,simonpf/root,nilqed/root,smarinac/root,zzxuanyuan/root-compressor-dummy,omazapa/root-old,smarinac/root,karies/root,georgtroska/root,zzxuanyuan/root,bbockelm/root,gbitzes/root,alexschlueter/cern-root,0x0all/ROOT,veprbl/root,zzxuanyuan/root-compressor-dummy,karies/root,omazapa/root,esakellari/my_root_for_test,bbockelm/root,sbinet/cxx-root,gganis/root,georgtroska/root,sawenzel/root,0x0all/ROOT,veprbl/root,sawenzel/root,esakellari/root,jrtomps/root,agarciamontoro/root,zzxuanyuan/root,omazapa/root,arch1tect0r/root,sawenzel/root,root-mirror/root,satyarth934/root,bbockelm/root,pspe/root,davidlt/root,omazapa/root,krafczyk/root,mkret2/root,omazapa/root,buuck/root,BerserkerTroll/root,esakellari/my_root_for_test,jrtomps/root,vukasinmilosevic/root,agarciamontoro/root,Y--/root,dfunke/root,gbitzes/root,davidlt/root,evgeny-boger/root,pspe/root,mkret2/root,root-mirror/root,sbinet/cxx-root,alexschlueter/cern-root,mattkretz/root,arch1tect0r/root,veprbl/root,veprbl/root,mattkretz/root,pspe/root,sawenzel/root,sbinet/cxx-root,gganis/root,0x0all/ROOT,zzxuanyuan/root,BerserkerTroll/root,vukasinmilosevic/root,bbockelm/root,gbitzes/root,0x0all/ROOT,Y--/root,zzxuanyuan/root-compressor-dummy,lgiommi/root,olifre/root,esakellari/my_root_for_test,vukasinmilosevic/root,beniz/root,omazapa/root-old,BerserkerTroll/root,abhinavmoudgil95/root,BerserkerTroll/root,root-mirror/root,buuck/root,sbinet/cxx-root,vukasinmilosevic/root,simonpf/root,mhuwiler/rootauto,CristinaCristescu/root,Y--/root,mkret2/root,esakellari/root,veprbl/root,smarinac/root,alexschlueter/cern-root,omazapa/root-old,buuck/root,cxx-hep/root-cern,gganis/root,gbitzes/root,CristinaCristescu/root,zzxuanyuan/root-compressor-dummy,vukasinmilosevic/root,zzxuanyuan/root-compressor-dummy,olifre/root,beniz/root,smarinac/root,abhinavmoudgil95/root,zzxuanyuan/root,davidlt/root,Duraznos/root,abhinavmoudgil95/root,simonpf/root,beniz/root,CristinaCristescu/root,simonpf/root,satyarth934/root,buuck/root,bbockelm/root,bbockelm/root,karies/root,smarinac/root,nilqed/root,mattkretz/root,zzxuanyuan/root-compressor-dummy,zzxuanyuan/root,omazapa/root,jrtomps/root,jrtomps/root,esakellari/my_root_for_test,BerserkerTroll/root,root-mirror/root,thomaskeck/root,omazapa/root-old,evgeny-boger/root,perovic/root,sbinet/cxx-root,sirinath/root,cxx-hep/root-cern,mhuwiler/rootauto,evgeny-boger/root,root-mirror/root,jrtomps/root,zzxuanyuan/root,sirinath/root,Duraznos/root,arch1tect0r/root,simonpf/root,perovic/root,gganis/root,georgtroska/root,omazapa/root-old,dfunke/root,Y--/root,omazapa/root,abhinavmoudgil95/root,esakellari/root,mkret2/root,arch1tect0r/root,satyarth934/root,esakellari/root,Duraznos/root,Duraznos/root,gganis/root,CristinaCristescu/root,pspe/root,karies/root,CristinaCristescu/root,georgtroska/root,omazapa/root-old,nilqed/root,bbockelm/root,pspe/root,krafczyk/root,krafczyk/root,pspe/root,0x0all/ROOT,esakellari/root,alexschlueter/cern-root,abhinavmoudgil95/root,davidlt/root,omazapa/root,CristinaCristescu/root,vukasinmilosevic/root,simonpf/root,gganis/root,zzxuanyuan/root-compressor-dummy,agarciamontoro/root,gbitzes/root,buuck/root,smarinac/root,agarciamontoro/root,olifre/root,krafczyk/root,abhinavmoudgil95/root,gbitzes/root,beniz/root,gganis/root,CristinaCristescu/root,vukasinmilosevic/root,CristinaCristescu/root,alexschlueter/cern-root,zzxuanyuan/root-compressor-dummy,omazapa/root-old,perovic/root,buuck/root,krafczyk/root,esakellari/root,karies/root,sawenzel/root,evgeny-boger/root,karies/root,zzxuanyuan/root-compressor-dummy,krafczyk/root,root-mirror/root,sbinet/cxx-root,alexschlueter/cern-root,arch1tect0r/root,perovic/root,esakellari/my_root_for_test,esakellari/my_root_for_test,jrtomps/root,0x0all/ROOT,mattkretz/root,thomaskeck/root,buuck/root,perovic/root,thomaskeck/root,cxx-hep/root-cern,Duraznos/root,evgeny-boger/root,satyarth934/root,Y--/root,alexschlueter/cern-root,abhinavmoudgil95/root,omazapa/root,agarciamontoro/root,evgeny-boger/root,karies/root,evgeny-boger/root,root-mirror/root,omazapa/root-old,abhinavmoudgil95/root,perovic/root,mkret2/root,BerserkerTroll/root,abhinavmoudgil95/root,thomaskeck/root,esakellari/my_root_for_test,buuck/root,abhinavmoudgil95/root,mhuwiler/rootauto,georgtroska/root,perovic/root,pspe/root,agarciamontoro/root,nilqed/root,Y--/root,vukasinmilosevic/root,gganis/root,simonpf/root,Duraznos/root,beniz/root,mattkretz/root,olifre/root,Duraznos/root,esakellari/root,krafczyk/root,olifre/root,vukasinmilosevic/root,jrtomps/root,georgtroska/root,olifre/root,mkret2/root,mkret2/root,vukasinmilosevic/root,abhinavmoudgil95/root,esakellari/my_root_for_test,arch1tect0r/root,sirinath/root,mkret2/root,satyarth934/root,buuck/root,krafczyk/root,0x0all/ROOT,beniz/root,dfunke/root,nilqed/root,mkret2/root,satyarth934/root,veprbl/root,esakellari/root,nilqed/root,arch1tect0r/root,buuck/root,satyarth934/root,dfunke/root,sbinet/cxx-root,omazapa/root,pspe/root,CristinaCristescu/root,BerserkerTroll/root,0x0all/ROOT,Duraznos/root,root-mirror/root,dfunke/root,Duraznos/root,veprbl/root,jrtomps/root,georgtroska/root,0x0all/ROOT,beniz/root,dfunke/root,krafczyk/root,mattkretz/root,georgtroska/root,omazapa/root-old,olifre/root,agarciamontoro/root