fltk-1.4 wanted feature: a callback before every poll(2) or blocking system call on Linux

25 views
Skip to first unread message

Basile Starynkevitch

unread,
May 23, 2024, 1:09:32 AMMay 23
to fltkc...@googlegroups.com, te...@refpersys.org
Hello all,


Regarding FLTK 1.4, that is its latest commit

> commit df3c87545399991167ee3902543b211cf10ec8b0 (HEAD -> master,
> origin/master, origin/HEAD)
> Author: ManoloFLTK <41016272+...@users.noreply.github.com>
> Date:   Tue May 21 15:28:18 2024 +0200
>
>     Beef up documentation about throttling window redraws under Wayland
>
> M       documentation/src/wayland.dox
>
and running on Linux/Debian/Trixie/x86-64, compiled by myself (using
with GCC 13 from Debian) using

./configure CC=/usr/bin/gcc-13 \
'CFLAGS=-O2 -fPIC -g -Wall -Wextra' CXX=/usr/bin/g++-13 \
'CXXFLAGS=-O2 -g -fPIC -Wall -Wextra' \
 '--disable-static'   '--enable-shared' '--enable-debug'  \
 '--with-abiversion' '--with-optim=-g -O2 -fPIC' '--sysconfdir=/etc/local/'


it would be nice to have a callback (or a short-running C++ routine,
which is supposed to run for much less than a millisecond) before every
poll or blocking system call on Linux.

Perhaps Fl::add_idle might be used for such a feature, but this is not
clear.

The useful scenarios could include:

FLTK (compiled with the system malloc/free....) using a library which
wants (or provides) its own and different malloc/free.

FLTK using a library which is profiled.

FLTK using a moving / precise garbage collector ; a use case might be to
embed FLTK in Ocaml, whose GC is moving, and with the additional code
enabling FLTK handlers to be coded in Ocaml; this GC would move pointers
in memory (except those allocated by FLTK) and needs to track the call
stack frames up to main (including the "recursion" involved by modal
dialogs). The same would probably be useful to embed FLTK inside the
SBCL lisp compiler (see sbcl.org) and is need by
https://github.com/RefPerSys/RefPerSys (an open source inference engine
project)

FLTK using the libbacktrace (by Ian Lance Taylor, in GCC)


Alternatively, some additional documentation in how to subclass the
Fl_Posix_System_Driver could be useful.

Thanks for reading.

Regards from near Paris in France.

--
Basile Starynkevitch <bas...@starynkevitch.net>
(only mine opinions / les opinions sont miennes uniquement)
8 rue de la Faïencerie, 92340 Bourg-la-Reine, France
web page: starynkevitch.net/Basile/
See/voir: https://github.com/RefPerSys/RefPerSys

Manolo

unread,
May 23, 2024, 3:09:54 AMMay 23
to fltk.coredev

Basile: could you, please, answer the question asked you in the FLTK issue #975 you opened yourself?

Manolo

unread,
May 23, 2024, 10:58:50 AMMay 23
to fltk.coredev

Albrecht Schlosser

unread,
May 26, 2024, 6:17:04 AMMay 26
to fltkc...@googlegroups.com
On 5/23/24 16:58 Manolo wrote:
>
> Fl::add_check() might be want you need. See:
> https://fltk.gitlab.io/fltk/classFl.html#a7b689a9e42582fe6e87f7c7eb1dce94f

Another option would be an infinite loop with Fl::wait() to replace
Fl::run() which does essentially that.

I'm leaving the details to the reader...

Reply all
Reply to author
Forward
0 new messages