https://github.com/cdown/stopthread
A small program to stop individual threads from executing, instead of the whole thread group.
https://github.com/cdown/stopthread
Last synced: about 1 month ago
JSON representation
A small program to stop individual threads from executing, instead of the whole thread group.
- Host: GitHub
- URL: https://github.com/cdown/stopthread
- Owner: cdown
- Created: 2019-03-20T15:56:35.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-20T16:11:11.000Z (about 6 years ago)
- Last Synced: 2025-02-06T07:30:40.930Z (3 months ago)
- Language: C
- Homepage:
- Size: 1.95 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A small program to stop individual threads from executing, instead of the whole
thread group.This is needed because SIGSTOP won't work on a single thread (even with
t(g)kill), because SIGSTOP and other job control-related signals only operate
on a whole thread group. PTRACE_SEIZE + PTRACE_INTERRUPT, while not really
designed for use in this way, are a satisfyingly hacky workaround.Use like so:
$ ./stopthread [list of tids]
Press Ctrl-C or send another signal to make the threads in question start
executing again and return to their original state.**WARNING:**
This can be used in emergencies to stem bleeding, however, be careful:
1. You must make sure that the threads you want to stop do not hold any
synchronisation primitives when stopped. Verify this using tracing first.
2. If running this on a service which understands admission control, you may
need to bump admission control limits to account for the stopped threads,
and allow new ones to execute.
3. If running this on a service which understands I/O gating, you may need to
bump I/O gating limits for the use cases the threads you're stopping are
classified as, to avoid unintentionally causing throttling for those use
cases.