Skip to content

Instantly share code, notes, and snippets.

@LeMeteore
Forked from ymmt2005/kill_thread.c
Created April 16, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeMeteore/c569afd5e6a3470ea249c408b1e54b78 to your computer and use it in GitHub Desktop.
Save LeMeteore/c569afd5e6a3470ea249c408b1e54b78 to your computer and use it in GitHub Desktop.
Kill a specific thread externally by using tgkill(2).
#include <signal.h>
#include <sys/syscall.h> /* For SYS_xxx definitions */
#include <sys/types.h>
#include <unistd.h>
int main() {
pid_t tgid=18456;
pid_t tid=24671;
return syscall(SYS_tgkill, tgid, tid, SIGABRT);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment