Prevent concurrent compilation of templates - closes #6400
Prevent concurrent compilation of templates - closes #6400

This addresses an issue where in multi-threaded environments
multiple threads can attempt to compile a template at the same time,
which occasionally causes particular templates to end up in a bad
state.

So, add synchronization such that only a single thread can attempt to
compile a template at one time.

gcourtemanche/rails,mtsmfm/rails,iainbeeston/rails,illacceptanything/illacceptanything,palkan/rails,kaspth/rails,joonyou/rails,baerjam/rails,riseshia/railsguides.kr,pvalena/rails,bogdanvlviv/rails,yawboakye/rails,rossta/rails,matrinox/rails,pvalena/rails,yawboakye/rails,gfvcastro/rails,EmmaB/rails-1,amoody2108/TechForJustice,alecspopa/rails,rails/rails,assain/rails,gfvcastro/rails,notapatch/rails,eileencodes/rails,yahonda/rails,yasslab/railsguides.jp,palkan/rails,richseviora/rails,Vasfed/rails,coreyward/rails,stefanmb/rails,bolek/rails,arunagw/rails,betesh/rails,illacceptanything/illacceptanything,tijwelch/rails,flanger001/rails,tijwelch/rails,eileencodes/rails,felipecvo/rails,rbhitchcock/rails,pschambacher/rails,notapatch/rails,Erol/rails,BlakeWilliams/rails,assain/rails,MSP-Greg/rails,yasslab/railsguides.jp,stefanmb/rails,fabianoleittes/rails,baerjam/rails,arunagw/rails,hanystudy/rails,brchristian/rails,untidy-hair/rails,illacceptanything/illacceptanything,iainbeeston/rails,mtsmfm/railstest,felipecvo/rails,voray/rails,ttanimichi/rails,shioyama/rails,schuetzm/rails,betesh/rails,vipulnsward/rails,georgeclaghorn/rails,lcreid/rails,Stellenticket/rails,illacceptanything/illacceptanything,shioyama/rails,elfassy/rails,kmcphillips/rails,BlakeWilliams/rails,MichaelSp/rails,bogdanvlviv/rails,xlymian/rails,lcreid/rails,shioyama/rails,Sen-Zhang/rails,untidy-hair/rails,rails/rails,travisofthenorth/rails,mechanicles/rails,mijoharas/rails,bradleypriest/rails,kaspth/rails,yalab/rails,odedniv/rails,MSP-Greg/rails,kirs/rails-1,ttanimichi/rails,kmcphillips/rails,iainbeeston/rails,printercu/rails,mechanicles/rails,sergey-alekseev/rails,kmcphillips/rails,yawboakye/rails,utilum/rails,Edouard-chin/rails,utilum/rails,rafaelfranca/omg-rails,Stellenticket/rails,Envek/rails,deraru/rails,pvalena/rails,baerjam/rails,yalab/rails,mechanicles/rails,odedniv/rails,arjes/rails,bradleypriest/rails,vipulnsward/rails,kmayer/rails,esparta/rails,tgxworld/rails,bolek/rails,repinel/rails,odedniv/rails,samphilipd/rails,lucasmazza/rails,palkan/rails,coreyward/rails,travisofthenorth/rails,assain/rails,rafaelfranca/omg-rails,bolek/rails,ttanimichi/rails,mohitnatoo/rails,tjschuck/rails,deraru/rails,kirs/rails-1,mathieujobin/reduced-rails-for-travis,kachick/rails,tjschuck/rails,MichaelSp/rails,rails/rails,Envek/rails,illacceptanything/illacceptanything,tjschuck/rails,jeremy/rails,ngpestelos/rails,pvalena/rails,joonyou/rails,matrinox/rails,coreyward/rails,Vasfed/rails,yhirano55/rails,sealocal/rails,richseviora/rails,MichaelSp/rails,Edouard-chin/rails,Spin42/rails,yahonda/rails,sergey-alekseev/rails,kddeisz/rails,88rabbit/newRails,deraru/rails,amoody2108/TechForJustice,marklocklear/rails,gavingmiller/rails,riseshia/railsguides.kr,Erol/rails,MSP-Greg/rails,fabianoleittes/rails,esparta/rails,mijoharas/rails,travisofthenorth/rails,jeremy/rails,maicher/rails,rossta/rails,georgeclaghorn/rails,gcourtemanche/rails,mtsmfm/rails,fabianoleittes/rails,Envek/rails,rails/rails,untidy-hair/rails,gavingmiller/rails,samphilipd/rails,Spin42/rails,pschambacher/rails,kenta-s/rails,mtsmfm/rails,untidy-hair/rails,mohitnatoo/rails,mohitnatoo/rails,kmcphillips/rails,voray/rails,yalab/rails,mechanicles/rails,prathamesh-sonpatki/rails,Vasfed/rails,schuetzm/rails,kmayer/rails,repinel/rails,voray/rails,bogdanvlviv/rails,elfassy/rails,mohitnatoo/rails,kaspth/rails,hanystudy/rails,kirs/rails-1,yalab/rails,MSP-Greg/rails,yahonda/rails,joonyou/rails,Edouard-chin/rails,ngpestelos/rails,assain/rails,Erol/rails,mtsmfm/railstest,printercu/rails,lcreid/rails,marklocklear/rails,matrinox/rails,deraru/rails,prathamesh-sonpatki/rails,illacceptanything/illacceptanything,sealocal/rails,illacceptanything/illacceptanything,arjes/rails,Spin42/rails,hanystudy/rails,gavingmiller/rails,palkan/rails,arunagw/rails,Stellenticket/rails,sergey-alekseev/rails,yawboakye/rails,alecspopa/rails,Erol/rails,georgeclaghorn/rails,yhirano55/rails,betesh/rails,tgxworld/rails,bradleypriest/rails,mijoharas/rails,gauravtiwari/rails,repinel/rails,samphilipd/rails,riseshia/railsguides.kr,maicher/rails,vipulnsward/rails,koic/rails,brchristian/rails,stefanmb/rails,illacceptanything/illacceptanything,mathieujobin/reduced-rails-for-travis,prathamesh-sonpatki/rails,illacceptanything/illacceptanything,gfvcastro/rails,yahonda/rails,vassilevsky/rails,koic/rails,marklocklear/rails,illacceptanything/illacceptanything,kmayer/rails,amoody2108/TechForJustice,xlymian/rails,kachick/rails,kamipo/rails,88rabbit/newRails,lucasmazza/rails,tgxworld/rails,prathamesh-sonpatki/rails,fabianoleittes/rails,arjes/rails,yhirano55/rails,brchristian/rails,gcourtemanche/rails,alecspopa/rails,kddeisz/rails,jeremy/rails,printercu/rails,tgxworld/rails,BlakeWilliams/rails,travisofthenorth/rails,tijwelch/rails,aditya-kapoor/rails,esparta/rails,illacceptanything/illacceptanything,illacceptanything/illacceptanything,richseviora/rails,koic/rails,88rabbit/newRails,rossta/rails,illacceptanything/illacceptanything,ledestin/rails,vassilevsky/rails,illacceptanything/illacceptanything,esparta/rails,flanger001/rails,vipulnsward/rails,aditya-kapoor/rails,mathieujobin/reduced-rails-for-travis,notapatch/rails,Sen-Zhang/rails,flanger001/rails,starknx/rails,rbhitchcock/rails,iainbeeston/rails,Stellenticket/rails,kachick/rails,kenta-s/rails,xlymian/rails,kenta-s/rails,kamipo/rails,kddeisz/rails,gauravtiwari/rails,bogdanvlviv/rails,BlakeWilliams/rails,yhirano55/rails,Vasfed/rails,eileencodes/rails,kamipo/rails,EmmaB/rails-1,eileencodes/rails,ledestin/rails,rafaelfranca/omg-rails,lcreid/rails,felipecvo/rails,sealocal/rails,ledestin/rails,utilum/rails,riseshia/railsguides.kr,shioyama/rails,notapatch/rails,flanger001/rails,lucasmazza/rails,EmmaB/rails-1,baerjam/rails,Edouard-chin/rails,maicher/rails,yasslab/railsguides.jp,gauravtiwari/rails,kddeisz/rails,betesh/rails,schuetzm/rails,jeremy/rails,aditya-kapoor/rails,joonyou/rails,repinel/rails,schuetzm/rails,georgeclaghorn/rails,aditya-kapoor/rails,Envek/rails,yasslab/railsguides.jp,illacceptanything/illacceptanything,vassilevsky/rails,Sen-Zhang/rails,starknx/rails,mtsmfm/railstest,rbhitchcock/rails,utilum/rails,gfvcastro/rails,arunagw/rails,pschambacher/rails,tjschuck/rails,ngpestelos/rails,printercu/rails,elfassy/rails,starknx/rails