我觉得没必要刻意用所谓的singleton模式,你只起一个线程专门处理不就是单例了吗
【 在 littleSram 的大作中提到: 】
: What is the best way to create and use a struct with only one instantiation in the system? Yes, this is necessary, it is the OpenGL subsystem, and making multiple copies of this and passing it around everywhere would add confusion, rather than relieve it.
: The singleton needs to be as efficient as possible. It doesn't seem possible to store an arbitrary object on the static area, as it contains a Vec with a destructor. The second option is to store an (unsafe) pointer on the static area, pointing to a heap allocated singleton. What is the most convenient and safest way to do this, while keeping syntax terse?
:
https://stackoverflow.com/questions/27791532/how-do-i-create-a-global-mutable-singleton: ...................
--
FROM 221.223.103.*