I'm reading about signals and I read that a signal that has been sent but not received is considered pending. Additionally, control jumps to a handler whenever a OS does a context switch to some process and discovers a pending and unblocked signal.
When is the bit for a signal in the pending bitmask cleared? Is it only when the handler finishes processing the signal? Or is it cleared the moment control jumps to the beginning of the handler?
I'm curious because I'm not sure what happens if for example, a SIGINT signal arrived while a SIGINT handler was already processing the signal and chose not to block further SIGINT signals. (I read that by default, signal handlers for signal K will block signal K by default but I'm wondering what happens if it is unblocked)