Design a singleton to return an object for each of the thread
Sigiloso
Using ThreadLocal can achieve this very easily. Make the desired singleton class extend ThreadLocal and override the lazy initialization initialValue() method. If the class is not allowed, using a ConcurrentHashMap with the Thread as key and the singleton class instance as value. If not using Java, i think c++ has a built-in thread local keyword that can mark the class thread local.