Move gil release/aquire outside of loop