magiblot / turbo

An experimental text editor based on Scintilla and Turbo Vision.
Other
461 stars 35 forks source link

Mac book air big sur cpu usage 100% #20

Closed vampiebar closed 3 years ago

vampiebar commented 3 years ago

in mac os big sur cpu usage ( when only open one cc file ) 100% cpu.. What can it be the reason?

magiblot commented 3 years ago

I'm not sure because I have never tested on macOS, but from what I can gather the problem is probably in the poll system call, which does not play nicely with /dev/tty.

The Turbo Vision library has a setting to avoid reading from /dev/tty and use standard input/output instead. Does the problem persist if you run Turbo with the environment variable TVISION_USE_STDIO set to 1? (in the command-line shell: TVISION_USE_STDIO=1 turbo or export TVISION_USE_STDIO=1; turbo)

vampiebar commented 3 years ago

TVISION_USE_STDIO=1 turbo or export TVISION_USE_STDIO=1; turbo

yes CPU is ok now everything is optimized.. what is missing when I do use stdio ? any side effect?

okbob commented 3 years ago

st 16. 6. 2021 v 14:57 odesílatel magiblot @.***> napsal:

I'm not sure because I have never tested on macOS, but from what I can gather the problem is probably in the poll system call, which does not play nicely with /dev/tty.

The Turbo Vision library has a setting to avoid reading from /dev/tty and use standard input/output instead. Does the problem persist if you run Turbo with the environment variable TVISION_USE_STDIO set to 1? (in the command-line shell: TVISION_USE_STDIO=1 turbo or export TVISION_USE_STDIO=1; turbo)

yes, /dev/tty and poll doesn't work together on macOS.

I use (in pspg)

ifndef APPLE

<--><-->/ macOS can't use poll() on /dev/tty / <--><-->state.tty = fopen("/dev/tty", "r+");

endif

<--><-->if (!state.tty) <--><--><-->state.tty = fopen(ttyname(fileno(stdout)), "r");

<--><-->if (!state.tty) <--><-->{ <--><--><-->if (!isatty(fileno(stderr))) <--><--><--><-->leave("missing a access to terminal device");

<--><--><-->state.tty = stderr; <--><-->}

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/magiblot/turbo/issues/20#issuecomment-862357314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEFO47LOO4I5S3RKI42OIDTTCNULANCNFSM46ZH43PQ .

magiblot commented 3 years ago

what is missing when I do use stdio ? any side effect?

No, in the case of Turbo there's nothing you need to worry about.

I use (in pspg)

Thanks for chiming in. Actually, I first learned about this problem when I spotted this commit in pspg: https://github.com/okbob/pspg/commit/776c8e89a062925e222bd8cc91ae238d96fb6b54