Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8006983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:41:09+00:00 2026-06-04T17:41:09+00:00

I am using pthread library under Linux for creating threads and I have two

  • 0

I am using pthread library under Linux for creating threads and I have two questions about signal handling in such applications.

I know that signal handlers are process-wide, which means that if I set handler in process every thread will have this signal handler, also I know that there is pthread_kill function for sending signals to particular threads.

I have a question about sending signals using for example shell kill command, as far as I understand, if I type for example kill -INT PID I will send SIGINT to process with this PID, if this is multithreaded program the signal will be delivered to one of the threads in this process.

First question, I won’t have any guarantee to which of the threads this signal will be delivered, I can only be sure that it will be delivered to one thread without this signal in signal mask?

If so what about few signals that are delivered to particular thread, like ‘SIGFPE’, ‘SIGSEGV’, if I will send them using kill shell command they will be delivered to random thread or will they be delivered to the thread that created other threads?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:41:11+00:00Added an answer on June 4, 2026 at 5:41 pm

    Citing man pthreads

    POSIX.1 distinguishes the notions of signals that are directed to the process as a whole and signals that are directed to individual threads. According to POSIX.1, a process-directed signal (sent using kill(2), for example) should be handled by a single, arbitrarily selected thread within the process.

    There were some problems in Linux at days of glibc 2.2 and older (linuxthreads was used as pthread implementation); but since glibc 2.3-2.4 there is NPTL which is more accurate in POSIX conformance about signals.

    I can only be sure that it will be delivered to one thread without this signal in signal mask?

    If you are using kill – yes; to random thread which doesn’t block this signal.

    If so what about few signals that are delivered to particular thread, like ‘SIGFPE’, ‘SIGSEGV’,

    They are delivered to particular thread, only when generated by CPU/kernel (by particular instruction in some context); not by kill utility with PID argument

    if I will send them using kill shell command they will be delivered to random thread or will they be delivered to the thread that created other threads?

    They will be delivered to random thread of process, kill usually sends process-wide signals. But if signal is deadly, all threads in process will be destroyed.

    PS: http://www.linuxprogrammingblog.com/all-about-linux-signals?page=11

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have an application that creates several threads using the pthread library. As we
I've been using the pthread library for creating & joining threads in C. When
If I create thread using Pthread library under Linux, I need to use function
I'm using pthread on Linux. I have a circular buffer to pass data from
I previously inquired about synchronizing two threads without using pthread_join and I was able
My environment is in Linux, using pthreads, compiled in gcc. I have 3 threads
i have two threads, they run pretty fast, i'm using pthread_mutex_lock and pthread_mutex_unlock to
Using the pthread library in C, is it possible to send a SIGSTOP signal
I am using the pthread library to simulate a threaded buffer. I am also
What C++ synchronization primitives can I use when using Linux's clone(2) threads? I specifically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.