Added safe malloc and realloc in event class
added api for creating threads and mutexes
Fixed focus, resize and close for win32