FAQ
Hello!
When I am trying to interrupt by ^C following program, it will freeze
output till it reaches 1k iterations.
However under cmd.exe it will stop immediately. C version stopped
immediately in both environments.

Does somebody encountered and investigated similar behaviour?
Regards,
-fz

Cygwin 1.7.16-1, WXP-32bit, go1.0.3





package main

func cpuIntensive(a uint64) (r uint64) {
for i := uint64(0); i < 1000000; i++ {
r = (r + i + a) / 2
}
return
}

func main() {
for i := uint64(0); i < 1000; i++ {
println(i, cpuIntensive(i))
}
}





#include <stdio.h>

unsigned long long cpuIntensive(unsigned long long a) {
unsigned long long i, r=0;
for (i= 0; i<1000000; i++) {
r = (r + i + a) / 2;
}
return r;
}

int main(void) {
unsigned long long i;
for (i=0; i<1000; i++) {
printf("%lli %lli\n", i, cpuIntensive(i));
}
return 0;
}

--

Search Discussions

  • Brainman at Dec 3, 2012 at 1:46 am
    Your program seems to behave properly under cmd.exe. I do not know why it
    is different on cygwin. See recent similar issue reported
    http://code.google.com/p/go/issues/detail?id=4347#c6. Maybe it will help
    you.

    Alex

    --
  • Filip Zaludek at Dec 3, 2012 at 10:12 am
    Thanks for reaction, Alex!

    I can confirm the same behaviour with CYGWIN 1.7.17; Meanwhile I observed
    that go version is not stracable. [-f] [-w]


    -fz

    --
  • Minux at Dec 3, 2012 at 10:39 am

    On Mon, Dec 3, 2012 at 6:06 PM, Filip Zaludek wrote:

    I can confirm the same behaviour with CYGWIN 1.7.17; Meanwhile I observed
    that go version is not stracable. [-f] [-w]
    Did you mean not tracable by cygwin strace? I think cygwin strace can only
    trace cygwin programs.
    for example, it can't trace mingw gcc.

    --
  • Filip Zaludek at Dec 3, 2012 at 11:02 am
    Oops, you are correct that cygwin strace works only with programs linked to
    cygwin1.dll..
    -fz

    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 1, '12 at 12:49a
activeDec 3, '12 at 11:02a
posts5
users3
websitegolang.org

3 users in discussion

Filip Zaludek: 3 posts Brainman: 1 post Minux: 1 post

People

Translate

site design / logo © 2022 Grokbase