added variable to inform 2nd thread about the finished work