move the semephore into struct