| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=gLAGGdPyS4blU/E5oj6Du2Y8/Whz2ZtLP8ozPqaGeleezmvBgzPd6 | |
| u4cfj478NSPzrDYWs9vavD/INSGqZsJtQARRmYMIifXl6qmvI6dBf2JWVf5KjMJz | |
| rTxW2GcgXxwdLL95HQzDJd/zrkJkYPxnOxMbL4NkwRj2FcepGjYl5Y= | |
| DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
| :list-unsubscribe:list-subscribe:list-archive:list-post | |
| :list-help:sender:date:from:to:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=vJefrjpJp5YFwtEnBtgRVQcK37U=; b=gqpYTflB3rAtaQKzpQOf9GSsiU4P | |
| dqt/ynU4Nxgl9vDO/ZgVSBgHhL8u3yfCL//StrfQCNWQfUVOC0kN9Iw0SiEYN2iG | |
| 2OHy0TYq1O0qSc2Zyy7rbpav13JFd2hvsEcSw6Km1H285pHqeKtjP6ug5FfqECs+ | |
| 6wFUM4EmfUmVsKo= | |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Authentication-Results: | sourceware.org; auth=none |
| X-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-5.9 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 |
| X-HELO: | calimero.vinschen.de |
| Date: | Fri, 24 Oct 2014 14:54:16 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: Threads |
| Message-ID: | <20141024125416.GK20607@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| References: | <54450835 DOT 3050602 AT cornell DOT edu> <5448E6F9 DOT 8040005 AT dronecode DOT org DOT uk> <5448EEBF DOT 3020706 AT cornell DOT edu> <20141023153730 DOT GC20607 AT calimero DOT vinschen DOT de> <544A327E DOT 9090006 AT dronecode DOT org DOT uk> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <544A327E.9090006@dronecode.org.uk> |
| User-Agent: | Mutt/1.5.23 (2014-03-12) |
--OOq1TgGhe8eTwFBO
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Oct 24 12:05, Jon TURNEY wrote:
> On 23/10/2014 16:37, Corinna Vinschen wrote:
> >On Oct 23 08:04, Ken Brown wrote:
> >>Yes, flags register corruption is exactly what Eli suggested in the oth=
er
> >>bug report I cited.
> >
> >The aforementioned patch was supposed to fix this problem and it is
> >definitely in the current 1.7.32 release...
>=20
> I didn't mean to suggest otherwise, just that perhaps a similar problem
> exists now.
>=20
> So I made the attached test case to explore that. Maybe I've made an
> obvious mistake with it, but on the face of it, it seems to demonstrate
> something...
>=20
> jon AT tambora /
> $ gcc signal-stress.c -Wall -O0 -g
>=20
> jon AT tambora /
> $ ./a
> failed: 2144210386 isn't equal to 2144210386, apparently
So it checks i and j for equality, fails, and then comes up with
"42 isn't equal to 42"? This is weird...
> Note there is some odd load dependency. For me, it works fine when it's t=
he
> only thing running, but when I start up something CPU intensive, it often
> fails...
That's... interesting. I wonder if that only occurs in multi-core or
multi-CPU environments. The fact that i and j are not the same when
testing, but then are the same when printf is called looks like a
out-of-order execution problem.
Is it possible that we have to add CPU memory barriers to the sigdelayed
function to avoid stuff like this?
Corinna
> #include <assert.h>
> #include <sys/time.h>
> #include <signal.h>
> #include <stdio.h>
>=20
> long SmartScheduleInterval =3D 1; /* ms */
> long SmartScheduleTime =3D 0;
>=20
> static void
> SmartScheduleTimer(int sig)
> {
> if (sig !=3D 0)
> SmartScheduleTime +=3D SmartScheduleInterval;
> }
>=20
> void
> SmartScheduleStartTimer(void)
> {
> struct itimerval timer;
> timer.it_interval.tv_sec =3D 0;
> timer.it_interval.tv_usec =3D SmartScheduleInterval * 1000;
> timer.it_value.tv_sec =3D 0;
> timer.it_value.tv_usec =3D SmartScheduleInterval * 1000;
> setitimer(ITIMER_REAL, &timer, 0);
> }
>=20
> int main()
> {
> /* Set up the timer signal function */
> struct sigaction act;
> act.sa_handler =3D SmartScheduleTimer;
> sigemptyset(&act.sa_mask);
> sigaddset(&act.sa_mask, SIGALRM);
> if (sigaction(SIGALRM, &act, 0) < 0) {
> perror("sigaction failed");
> return -1;
> }
>=20
> /* start timer */
> SmartScheduleStartTimer();
>=20
> /* Loop forever, doing tests which should always succeed, with lots of=
signals */
> int x =3D 0;
> int i =3D 0;
> while (1) {
> x =3D i;
> int j =3D x;
> if (j !=3D i)
> {
> printf("failed: %d isn't equal to %d, apparently\n", i, j);
> break;
> }
> i++;
> }
> return 0;
> }
> --
> Problem reports: http://cygwin.com/problems.html
> FAQ: http://cygwin.com/faq/
> Documentation: http://cygwin.com/docs.html
> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
--=20
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
--OOq1TgGhe8eTwFBO
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJUSkv4AAoJEPU2Bp2uRE+gPNAP/0+6KVQY8ikTCfETfpaeutkP
uIO+Y0Dt3kKe6vxvEXOZdJKjEqka/7Hk7uXldGQJuiiK21VBfKIrIadIE56+IIld
vxMX4GLS4AIWEiEpvbb2Mj+iUJ33zBB+5BTqK71VYR2Ok3XNLJlS6obJ96GCkmSp
nOPfK48Zc6GHtFRwnXqrMy2lWqPh/P8H/PCVhx7oiLV/T7H89rItpCuW7pTrcce4
xaAbEk55fhaIdWtBjFeScunenofRO6B6FT9FI3JJS/uiuILiGTj6+awI5Qwt1xA1
ayQ6oc5PDvW8typO+YidH6hqLwENsuh+skSFUdSSlk1RimN3JO0Ikt2OCM98aLrj
mrK4d6iIvWq0EjGl9ONJQ3RzyjlgoKTZ3XZ4bxHGMOYKRX35CtS4M9LGQ+uqJ0Gc
ahnNqolfKk0YUHyfsDx0CL6PeVnem3nUNbGCPsGJz0mhyF51YFLqg3zLVoujYStR
9kU05xPM/Wz2S/3tRWilTZncouXMoiAU2BIMJigvA+tWjxWdQzIri0OVzODKPibN
oP9GypdyqaW2SvVfFGGSJfUOptpA8jQhmCgDOEnRh64stA2lQI/jzO09l+C7YHEU
BX4wal7LPcn8tuhkzblJDZQ/EXekFGbsMnXTZ8w4dG4tOQ8oeSpGccudQ8ukdL2F
VTp6CZm1oqyvDBS4ZoEb
=FGX6
-----END PGP SIGNATURE-----
--OOq1TgGhe8eTwFBO--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |