Succesfully working using mutex and cond, still a tiny bug (Probably when turning off - stuck on condwait)