From: Ken Brown <kbrown@cornell.edu>
To: 14569@debbugs.gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>,
Angelo Graziosi <angelo.graziosi@alice.it>
Subject: bug#14569: 24.3.50; bootstrap fails on Cygwin
Date: Sun, 16 Jun 2013 14:20:28 -0400 [thread overview]
Message-ID: <51BE01EC.3000701@cornell.edu> (raw)
In-Reply-To: <51BDFB25.8080101@cornell.edu>
[-- Attachment #1: Type: text/plain, Size: 814 bytes --]
On 6/16/2013 1:51 PM, Ken Brown wrote:
>> ERRORS
>> EINTR The call was interrupted by a signal handler; see
>> signal(7).
I've revised the test case (attached) so that it checks for EINTR. It
now runs as expected on Cygwin:
Testing pthread_kill()
Thread 0 starting (0x800102a8)
Thread 1 starting (0x80010348)
Thread 2 starting (0x800103e8)
Sending SIGUSR1 to thread 2 (0x800103e8)
Thread 2 executes signal handler (0x800103e8)
Thread 2 woke up just fine
Sending SIGUSR1 to thread 1 (0x80010348)
Thread 1 executes signal handler (0x80010348)
Thread 1 woke up just fine
Sending SIGUSR1 to thread 0 (0x800102a8)
Thread 0 executes signal handler (0x800102a8)
Thread 0 woke up just fine
So there's no reason to think that a pthread_kill bug is causing the
problem. Back to the drawing board.
Ken
[-- Attachment #2: otto_test4.c --]
[-- Type: text/plain, Size: 2563 bytes --]
/* http://cygwin.com/ml/cygwin/2012-05/msg00434.html */
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
pthread_t tids[3];
sem_t semaphore;
static void cleanup_handler(void *arg) {
int *intptr = (int*)arg;
pthread_t self = pthread_self();
fprintf(stderr, "Thread %i exiting (%p)\n", *intptr, self);
}
static void* simplethread(void *arg) {
int *intptr = (int*)arg;
pthread_t self = pthread_self();
fprintf(stderr, "Thread %i starting (%p)\n", *intptr, self);
pthread_cleanup_push(&cleanup_handler, intptr);
while (1) {
if (sem_wait(&semaphore) != 0 && errno != EINTR) {
fprintf(stderr, "Thread %i encountered an error: %s (%p)\n",
*intptr, strerror(errno), self);
} else {
fprintf(stderr, "Thread %i woke up just fine\n", *intptr);
}
}
pthread_cleanup_pop(1);
return NULL;
}
static void sigusr1_handler(int signal __attribute((unused))) {
pthread_t self = pthread_self();
int tnum = 0;
while (tnum < 3) {
if (tids[tnum] == self) {
break;
}
tnum++;
}
fprintf(stderr, "Thread %i executes signal handler (%p)\n", tnum, self);
}
static void install_handler(void) {
struct sigaction act;
act.sa_handler = &sigusr1_handler;
sigemptyset(&(act.sa_mask));
act.sa_flags = 0;
if (sigaction(SIGUSR1, &act, NULL) != 0) {
fprintf(stderr, "Can't set signal handler: %s\n", strerror(errno));
exit(1);
}
sigset_t sset;
sigemptyset(&sset);
sigaddset(&sset, SIGUSR1);
if (sigprocmask(SIG_UNBLOCK, &sset, NULL) != 0) {
fprintf(stderr, "Can't unblock SIGUSR1: %s\n", strerror(errno));
}
}
int main() {
fprintf(stderr, "Testing pthread_kill()\n\n");
int i;
int result;
sem_init(&semaphore, 0, 0);
install_handler();
for (i=0; i<3; i++) {
int *intptr = (int*)malloc(sizeof(int));
*intptr = i;
result = pthread_create(tids+i, NULL, &simplethread, intptr);
if (result != 0) {
fprintf(stderr, "Can't create thread: %s\n", strerror(result));
return 1;
}
}
sleep(1);
install_handler();
fprintf(stderr, "\n");
int mainint = 42;
pthread_cleanup_push(&cleanup_handler, &mainint);
for (i=2; i>=0; i--) {
fprintf(stderr, "Sending SIGUSR1 to thread %i (%p)\n", i, tids[i]);
result = pthread_kill(tids[i], SIGUSR1);
if (result != 0) {
fprintf(stderr, "Error during pthread_kill: %s\n", strerror(result));
}
sleep(1);
}
pthread_cleanup_pop(0);
return 0;
}
next prev parent reply other threads:[~2013-06-16 18:20 UTC|newest]
Thread overview: 116+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-15 13:54 bug#14569: 24.3.50; bootstrap fails on Cygwin Angelo Graziosi
2013-06-16 13:11 ` Ken Brown
[not found] ` <51BDB979.3040508@cornell.edu>
[not found] ` <20130616150141.GB3622@ednor.casa.cgf.cx>
2013-06-16 17:51 ` Ken Brown
[not found] ` <51BDFB25.8080101@cornell.edu>
2013-06-16 18:20 ` Ken Brown [this message]
2013-06-22 20:49 ` Angelo Graziosi
2013-06-23 19:49 ` Angelo Graziosi
2013-06-23 20:47 ` Angelo Graziosi
2013-06-24 2:43 ` Eli Zaretskii
2013-06-24 0:34 ` Paul Eggert
2013-06-24 11:02 ` Ken Brown
2013-06-24 14:34 ` Paul Eggert
2013-06-24 15:51 ` Ken Brown
2013-06-24 16:55 ` Paul Eggert
2013-06-24 17:16 ` Ken Brown
2013-06-24 17:50 ` Angelo Graziosi
2013-06-24 21:05 ` Paul Eggert
2013-06-24 23:50 ` Angelo Graziosi
2013-06-25 13:34 ` Ken Brown
2013-06-25 13:55 ` Ken Brown
2013-06-25 14:51 ` Paul Eggert
2013-06-25 15:51 ` Ken Brown
2013-06-25 16:18 ` Paul Eggert
2013-06-27 14:56 ` Paul Eggert
2013-06-27 16:44 ` Angelo Graziosi
2013-06-27 16:54 ` Angelo Graziosi
2013-06-28 5:16 ` Paul Eggert
2013-06-27 19:32 ` Ken Brown
2013-06-28 12:20 ` Ken Brown
2013-06-28 14:50 ` Paul Eggert
2013-06-28 15:29 ` Ken Brown
2013-06-28 16:22 ` Angelo Graziosi
2013-06-28 21:40 ` Ken Brown
2013-07-01 11:21 ` Ken Brown
2013-07-01 12:28 ` Angelo Graziosi
2013-07-01 13:51 ` Ken Brown
2013-07-01 14:04 ` Ken Brown
2013-07-01 14:19 ` Paul Eggert
2013-07-01 16:16 ` Ken Brown
2013-07-01 17:31 ` Angelo Graziosi
2013-07-01 18:40 ` Ken Brown
2013-07-01 21:07 ` Paul Eggert
2013-07-01 21:47 ` Angelo Graziosi
2013-07-01 22:41 ` Ken Brown
2013-06-07 0:16 ` Katsumi Yamaoka
2013-06-10 13:54 ` Angelo Graziosi
2013-06-10 16:27 ` Jan Djärv
2013-06-10 18:56 ` Angelo Graziosi
2013-06-10 20:10 ` Paul Eggert
2013-06-10 21:15 ` Angelo Graziosi
2013-06-10 21:52 ` Paul Eggert
2013-06-10 22:06 ` Angelo Graziosi
2013-06-10 23:23 ` Angelo Graziosi
2013-06-11 15:13 ` Angelo Graziosi
2013-06-11 18:10 ` Paul Eggert
2013-06-11 20:13 ` Angelo Graziosi
2013-06-11 15:39 ` Jan Djärv
2013-06-11 16:58 ` Eli Zaretskii
2013-06-11 18:50 ` Paul Eggert
2013-06-11 19:26 ` Ken Brown
2013-06-11 19:53 ` Eli Zaretskii
2013-06-11 20:06 ` Ken Brown
2013-06-11 20:58 ` Jan Djärv
2013-06-11 20:59 ` Jan Djärv
2013-06-12 7:00 ` Jan Djärv
2013-06-12 18:33 ` Paul Eggert
2013-06-12 20:11 ` Angelo Graziosi
2013-06-13 7:08 ` Jan Djärv
2013-06-13 17:39 ` Paul Eggert
2013-06-14 9:11 ` Jan Djärv
2013-06-14 17:45 ` Paul Eggert
[not found] ` <51BB56CB.7030209@cs.ucla.edu>
2013-06-14 18:03 ` Christopher Faylor
2013-06-14 18:03 ` Christopher Faylor
2013-06-14 18:16 ` Eli Zaretskii
[not found] ` <20130614180359.GA5295@ednor.casa.cgf.cx>
2013-06-14 20:22 ` Ken Brown
[not found] ` <51BB7B82.4010204@cornell.edu>
2013-06-15 7:04 ` Eli Zaretskii
2013-06-15 9:54 ` Jan Djärv
2013-06-15 10:42 ` Eli Zaretskii
2013-06-15 12:47 ` Jan Djärv
2013-06-17 1:56 ` Ken Brown
2013-06-17 6:22 ` Jan Djärv
2013-06-17 15:06 ` Eli Zaretskii
2013-06-17 20:15 ` Ken Brown
2013-06-18 15:53 ` Eli Zaretskii
2013-06-19 20:24 ` Ken Brown
2013-06-20 2:45 ` Eli Zaretskii
2013-06-20 3:00 ` Ken Brown
2013-06-20 15:54 ` Eli Zaretskii
2013-06-22 15:13 ` Ken Brown
2013-06-22 19:04 ` Paul Eggert
2013-06-23 15:56 ` Ken Brown
2013-06-23 16:13 ` Eli Zaretskii
2013-06-23 18:22 ` Paul Eggert
2013-06-12 4:29 ` Katsumi Yamaoka
2013-07-02 2:19 ` Katsumi Yamaoka
2013-07-02 5:23 ` Katsumi Yamaoka
2013-07-02 11:22 ` Ken Brown
2013-07-02 13:57 ` Katsumi Yamaoka
2013-07-04 2:27 ` bug#14569: Emacs segfaulting on FreeBSD 9.1-RELEASE (amd64) during memory allocation wahjava.ml
2013-07-17 6:36 ` bug#14569: bug#14766: 24.3.50; sometimes "Memory exhausted" on Cygwin Katsumi Yamaoka
-- strict thread matches above, loose matches on Subject: below --
2013-07-02 13:57 Katsumi Yamaoka
2013-07-02 14:15 ` Angelo Graziosi
2013-07-03 2:31 ` Katsumi Yamaoka
2013-07-02 19:56 ` Ken Brown
2013-07-03 2:30 ` Katsumi Yamaoka
2013-07-03 3:24 ` Ken Brown
2013-07-03 4:54 ` Paul Eggert
2013-07-03 10:01 ` Katsumi Yamaoka
2013-07-03 10:57 ` Ken Brown
2013-07-03 11:48 ` Katsumi Yamaoka
2013-07-03 6:36 ` Michael Albinus
2013-07-03 10:01 ` Katsumi Yamaoka
[not found] <86d2qz3a7q.fsf@chateau.d.if>
2013-07-04 0:58 ` bug#14569: Emacs segfaulting on FreeBSD 9.1-RELEASE (amd64) during memory allocation Paul Eggert
2013-07-04 2:13 ` Ken Brown
[not found] ` <86txkbys94.fsf@chateau.d.if>
2013-07-04 6:23 ` Paul Eggert
2013-07-04 10:59 ` Ken Brown
2013-07-04 19:09 ` Ashish SHUKLA
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51BE01EC.3000701@cornell.edu \
--to=kbrown@cornell.edu \
--cc=14569@debbugs.gnu.org \
--cc=angelo.graziosi@alice.it \
--cc=eggert@cs.ucla.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).