]> git.ipfire.org Git - thirdparty/elfutils.git/commit
src: Add threadlib library for parallel job execution
authorAaron Merey <amerey@redhat.com>
Tue, 5 Aug 2025 03:20:52 +0000 (23:20 -0400)
committerAaron Merey <amerey@redhat.com>
Tue, 12 Aug 2025 13:27:09 +0000 (09:27 -0400)
commit28b8e2b0f9b80a63743be2e73058449abc7f17bc
tree1fcc11731bd8aee1faf9db21149d86556095be7a
parent4ad22eb915cda8e9c8a149e98a83c208e4a844e6
src: Add threadlib library for parallel job execution

Add new internal static library libthread.a that provides infrastructure
for eu-* tools to run functions concurrently using pthreads.

threadlib.c manages per-job threads as well as per-job buffers for stdout
output.  Output for each job is printed to stdout in the order that the
jobs were added to the job queue.  This helps preserve the order of
output when parallelization is added to an eu-* tool.

threadlib.h declares functions add_job and run_jobs. Jobs are added to
a threadlib.c internal job queue using add_job. run_jobs concurrently
executes jobs in parallel.

eu-readelf now links against libthread.a when elfutils is configured
with --enable-thread-safety.

* src/Makefile.am: libthread.a is compiled and and linked with
readelf when USE_LOCKS is defined.
* src/threadlib.c: New file. Manages job creation, concurrent
execution and output handling.
* src/threadlib.h: New file. Declares functions add_job and
run_jobs.

Signed-off-by: Aaron Merey <amerey@redhat.com>
src/Makefile.am
src/threadlib.c [new file with mode: 0644]
src/threadlib.h [new file with mode: 0644]