Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 1998 14:53:21 -0500
From:      Larry Ching <lching@cisco.com>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        hackers@FreeBSD.ORG, lching@cisco.com
Subject:   Re: pthreads question
Message-ID:  <367EA731.BFAB48C3@cisco.com>
References:  <199812211933.OAA01713@pcnet1.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Daniel Eischen wrote:

> Larry Ching wrote:
>
> > > A quick glance of the code shows that this is what happens only
> > > if the signal is blocked in the thread.  If the signal is unblocked,
> > > then the thread should return with EINTR.  Use sigprocmask(2) to
> > > unblock the signal in the thread that you want to interrupt.
> >
> > Thank you for your help above.  The thread in question was making acall
> > to pthread_sigmask(SIG_UNBLOCK,...) to unblock the signal I
> > was using in pthread_kill().  I changed this call to
> > sigprocmask(SIG_UNBLOCK, ...) with no effect.  The thread remains
> > blocked in the read() call and no EINTR error code is returned.
> >
> > Any suggestions as to where to look next???
>
> You haven't set the action for the signal to SIG_IGN, have you?

There is this code segment in the thread to be killed:

  struct sigaction sa;
  sigset_t setUser1;

  sa.sa_handler = SigUsr1Handler;
  sigemptyset(&sa.sa_mask);
  sa.sa_flags = 0;
  sigaction(SIGUSR1, &sa, NULL);

  sigemptyset(&setUser1);
  sigaddset(&setUser1, SIGUSR1);
  sigprocmask(SIG_UNBLOCK, &setUser1, NULL);
  //pthread_sigmask(SIG_UNBLOCK, &setUser1, NULL);

where SigUsr1Handler is defined as:

void SigUsr1Handler(int signal)
{
}

My understanding is that this guarantees the action to not
be SIG_IGN.  I don't understand why this is not sufficient
for the read() call to be interrupted.

> Got a simple prgram to demonstrate the problem?

No, but I will attempt to create one.

Larry Ching
Cisco Systems
lching@cisco.com



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?367EA731.BFAB48C3>