Added simple thread-safe queue implementation