From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Brown Newsgroups: gmane.emacs.bugs Subject: bug#14569: 24.3.50; bootstrap fails on Cygwin Date: Sun, 16 Jun 2013 14:20:28 -0400 Message-ID: <51BE01EC.3000701@cornell.edu> References: <51BC720D.7080504@alice.it> <51BDB979.3040508@cornell.edu> <20130616150141.GB3622@ednor.casa.cgf.cx> <51BDFB25.8080101@cornell.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------040600010407080209030104" X-Trace: ger.gmane.org 1371406929 11650 80.91.229.3 (16 Jun 2013 18:22:09 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2013 18:22:09 +0000 (UTC) Cc: Paul Eggert , Angelo Graziosi To: 14569@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 16 20:22:09 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UoHab-0004IU-DY for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Jun 2013 20:22:09 +0200 Original-Received: from localhost ([::1]:36081 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoHab-0001RE-0I for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Jun 2013 14:22:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoHaV-0001Qw-FP for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 14:22:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UoHaU-00014T-7S for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 14:22:03 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UoHaU-00014P-4a for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 14:22:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UoHaT-0001fL-Mp for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 14:22:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ken Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jun 2013 18:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14569 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14569-submit@debbugs.gnu.org id=B14569.13714068796327 (code B ref 14569); Sun, 16 Jun 2013 18:22:01 +0000 Original-Received: (at 14569) by debbugs.gnu.org; 16 Jun 2013 18:21:19 +0000 Original-Received: from localhost ([127.0.0.1]:48803 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UoHZm-0001dv-PJ for submit@debbugs.gnu.org; Sun, 16 Jun 2013 14:21:19 -0400 Original-Received: from limestone5.mail.cornell.edu ([128.253.83.165]:42193) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UoHZj-0001dY-PN for 14569@debbugs.gnu.org; Sun, 16 Jun 2013 14:21:17 -0400 X-CornellRouted: This message has been Routed already. Original-Received: from authusersmtp.mail.cornell.edu ([10.16.197.8]) by limestone5.mail.cornell.edu (8.14.4/8.14.4) with ESMTP id r5GIKxRm018730; Sun, 16 Jun 2013 14:20:59 -0400 (EDT) Original-Received: from [192.168.1.6] (cpe-67-249-194-47.twcny.res.rr.com [67.249.194.47]) (authenticated bits=0) by authusersmtp.mail.cornell.edu (8.14.4/8.12.10) with ESMTP id r5GIKxkJ013016 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 16 Jun 2013 14:20:59 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <51BDFB25.8080101@cornell.edu> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75225 Archived-At: This is a multi-part message in MIME format. --------------040600010407080209030104 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------040600010407080209030104 Content-Type: text/plain; charset=windows-1252; name="otto_test4.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="otto_test4.c" /* http://cygwin.com/ml/cygwin/2012-05/msg00434.html */ #include #include #include #include #include #include #include #include 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; } --------------040600010407080209030104--