C based event handler system