)]}'
{
  "commit": "71641049a91253f7547f792ec2fcb6609794ea4f",
  "tree": "c15f34ec89183bbb366c9eb0b3e5085b15665c65",
  "parents": [
    "3f4d116978044e2acc5e9a36196cf2a7d790319e"
  ],
  "author": {
    "name": "Schrodinger ZHU Yifan",
    "email": "yifanzhu@rochester.edu",
    "time": "Wed Sep 03 09:02:03 2025 -0400"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Sep 03 09:02:03 2025 -0400"
  },
  "message": "[libc] ensure tls dtors are called in main thread (#133641)\n\nThis is a part of allocator patch since I want to make sure the TLS for\nallocators are correctly handled.\n\nTLS dtors are not invoked on exit previously. This departures from major\nlibc implementations.\n\nThis PR fixes the issue by aligning the behavior with bionic.\n\n\nhttps://android.googlesource.com/platform/bionic/+/refs/heads/main/libc/bionic/exit.cpp\n\nI believe the finalization order is also consistent with glibc now:\n\nOn main thread exiting:\n\n- pthread_key dtors are not called (unless exiting with `pthread_exit`)\n- `__cxa` based tls dtors are called\n- `::__cxa_atexit` and `::atexit` dtors are called\n- `.fini` dtors are called\n\n\n![image](https://github.com/user-attachments/assets/737c4845-cab6-47a9-aa00-32997be141bd)",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "6f6b75be5766d0111bb748c45e20b8e5651d2075",
      "old_mode": 33188,
      "old_path": "libc/src/__support/threads/thread.cpp",
      "new_id": "9618d7829161ab44c398c71987e59fe4a39acd33",
      "new_mode": 33188,
      "new_path": "libc/src/__support/threads/thread.cpp"
    },
    {
      "type": "modify",
      "old_id": "114ab4932af72cb7fffd911c631f732183b767aa",
      "old_mode": 33188,
      "old_path": "libc/src/__support/threads/thread.h",
      "new_id": "6806098653b2ca4f5602127f7b0c7f827265255e",
      "new_mode": 33188,
      "new_path": "libc/src/__support/threads/thread.h"
    },
    {
      "type": "modify",
      "old_id": "28a6f8a63c0c6749b45364bb286b12559f095ef8",
      "old_mode": 33188,
      "old_path": "libc/src/stdlib/exit.cpp",
      "new_id": "ef3b8dd24630576fed97859bb62bf5b97b8a50d3",
      "new_mode": 33188,
      "new_path": "libc/src/stdlib/exit.cpp"
    },
    {
      "type": "modify",
      "old_id": "5a12d28ada3fdabc1c0e72a543e4c22b005570c2",
      "old_mode": 33188,
      "old_path": "libc/test/integration/src/__support/threads/CMakeLists.txt",
      "new_id": "40e96681b1207f06ee30c30d75a01e9889f1078a",
      "new_mode": 33188,
      "new_path": "libc/test/integration/src/__support/threads/CMakeLists.txt"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "86749d937c10c031d156f0c279c9978b7c63a9a6",
      "new_mode": 33188,
      "new_path": "libc/test/integration/src/__support/threads/double_exit_test.cpp"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c90e4e569cfba45e795784cd327f2676872f9931",
      "new_mode": 33188,
      "new_path": "libc/test/integration/src/__support/threads/main_exit_test.cpp"
    }
  ]
}
