add signal function

use the signal function to catch the C^c