Added lock funcion for linux