chg: defer shutdown caused by SIGTERM if necessary
(cherry picked from commit a76a64e703bae29ffee8057ab2b16abb20f9158a)

Signed-off-by: Andreas Steenpass <steenpass@mathematik.uni-kl.de>

Conflicts:
	Singular/cntrlc.cc
	Singular/cntrlc.h
	Singular/misc_ip.cc
chg: release acquired semaphores before shutdown
(cherry picked from commit 0f27f90c69fc9952c3df5edb6dff0b57fd8ff826)

Signed-off-by: Andreas Steenpass <steenpass@mathematik.uni-kl.de>

Conflicts:
	Singular/links/semaphore.c
	Singular/misc_ip.cc
Merge pull request #414 from steenpass/resources_sw

release acquired semaphores before shutdown