)]}'
{
  "commit": "08a48dff02328ecae81250df39e0e9940afd4e67",
  "tree": "9f971e0f5f1b974b4c29ff238d262fd8435538ed",
  "parents": [
    "20e3867ad8935f5f5c52ea31ae3fa1f0cc449256"
  ],
  "author": {
    "name": "Simon Marchi",
    "email": "simon.marchi@polymtl.ca",
    "time": "Fri Sep 19 16:27:04 2025 -0400"
  },
  "committer": {
    "name": "Simon Marchi",
    "email": "simon.marchi@efficios.com",
    "time": "Tue Sep 30 19:37:20 2025 +0000"
  },
  "message": "gdbsupport: add async parallel_for_each version\n\nI would like to use gdb::parallel_for_each to implement the parallelism\nof the DWARF unit indexing.  However, the existing implementation of\ngdb::parallel_for_each is blocking, which doesn\u0027t work with the model\nused by the DWARF indexer, which is asynchronous and callback-based.\nAdd an asynchronouys version of gdb::parallel_for_each that will be\nsuitable for this task.\n\nThis new version accepts a callback that is invoked when the parallel\nfor each is complete.\n\nThis function uses the same strategy as gdb::task_group to invoke the\n\"done\" callback: worker threads have a shared_ptr reference to some\nobject.  The last worker thread to drop its reference causes the object\nto be deleted, which invokes the callback.\n\nUnlike for the sync version of gdb::parallel_for_each, it\u0027s not possible\nto keep any state in the calling thread\u0027s stack, because that disappears\nimmediately after starting the workers.  So all the state is kept in\nthat same shared object.\n\nThere is a limitation that the sync version doesn\u0027t have, regarding the\narguments you can pass to the worker objects: it\u0027s not possibly to rely\non references.  There are more details in a comment in the code.\n\nIt would be possible to implement the sync version of\ngdb::parallel_for_each on top of the async version, but I decided not to\ndo it to avoid the unnecessary dynamic allocation of the shared object,\nand to avoid adding the limitations on passing references I mentioned\njust above.  But if we judge that it would be an acceptable cost to\navoid the duplication, we could do it.\n\nAdd a self test for the new function.\n\nChange-Id: I6173defb1e09856d137c1aa05ad51cbf521ea0b0\nApproved-By: Tom Tromey \u003ctom@tromey.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "54556c9861c62a9fc3aaa629c5ec266c0d992926",
      "old_mode": 33188,
      "old_path": "gdb/unittests/parallel-for-selftests.c",
      "new_id": "b69eed43d5c02315d39518f8fce24b6581d63ef8",
      "new_mode": 33188,
      "new_path": "gdb/unittests/parallel-for-selftests.c"
    },
    {
      "type": "modify",
      "old_id": "7baa768c0473e1fe45e92c86c3268526400cb3dd",
      "old_mode": 33188,
      "old_path": "gdbsupport/parallel-for.h",
      "new_id": "7f3fef96c9cf89a51e795dd584e10e2ca5ba9919",
      "new_mode": 33188,
      "new_path": "gdbsupport/parallel-for.h"
    }
  ]
}
