boost::thread_specific_ptr/cleanup vs atexit 执行顺序

boost::thread_specific_ptr/cleanup vs atexit execution order

如果多线程应用程序被 exit(x) 或 "return" 从 main 终止 - 处理程序的执行顺序是什么?

  1. atexit 注册的处理程序
  2. pthread_key_create/thread_specific_ptr 清理处理程序(所谓的析构函数)

或者相反?

谢谢。

来自http://www.cplusplus.com/reference/cstdlib/atexit

If more than one atexit function has been specified by different calls to this function, they are all executed in reverse order as a stack (i.e. the last function specified is the first to be executed at exit).