Page MenuHome

Thread naming support (for debugging)
Closed, ArchivedPublic

Description

Description

This patch adds:

  • A pool_name argument to BLI_threadpool_init, which is used to name the thread that gets created
  • A utility function called BLI_thread_name_set for setting the name of the currently running thread from anywhere

The latter is used in blenlib's Task Scheduler, additionally denoting whether the Task Scheduler in question is currently waiting or running.

The former is of course an API breaking change, so the patch touches a handful of projects.

Compatibility

The code is written for Windows (MSVC), Linux, FreeBSD and macOS and tested on Windows (thread names appear in the Thread list).

Rationale

The is a debugging aid, which is why it's only enabled on Debug builds (and for Windows, specifically when the MSVC debugger is attached).

Patch

Details

Type
Patch