Update thread.c

Implemented alarm + priority scheduling