Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler: Set a simple custom record printer. #82

Merged
merged 11 commits into from
Sep 14, 2023

Conversation

cbaines
Copy link

@cbaines cbaines commented Apr 21, 2023

The default record printer in Guile seems to produce a large (maybe infinite) output for schedulers, so this simple record printer prevents that.

@davexunit
Copy link

Something like this would be great! Maybe it would be good to print out a few of the fields, though. The key thing to not print is the remote-peers field, but maybe it would be nice to see a count of remote peers.

emixa-d and others added 5 commits August 28, 2023 01:14
* fibers.texi (make-read-operation,make-write-operation): Document
them.
* fibers/io-wakeup.scm (make-wait-operation): Remove this-procedure
argument.  Instead, reuse the constructed operation object.
Replace 'ready?' argument by a more generic 'try-fn' argument, moving
the difference into ...
(try-ready): ... this new procedure.
(wait-until-port-readable-operation): Move everything except the try
procedure into ...
(make-read-operation): ... this new (exported) procedure.
(wait-until-port-writable-operation): Likewise, move things into ...
(wait-until-port-readable-operation): ... this new (exported) procedure.
In retrospect, make-x/timeout? is an independent change, but it fits
and is a trivial change, so it's pointless to split it off to a new
commit.

* fibers.texi (with-read-waiting-is-failure,with-write-waiting-is-failure)
(make-read-operation,make-write-operation,accept-operation): Define
new procedures and add context.
* tests/io-wakeup.scm: Test the new procedures.
(readable/timeout?,writable/timeout?): Extract a new procedure ...
(make-x/timeout?): ..., sharing common functionality.
(accepted-socket,accept*-operation,accept*/timeout?): New stuff.
(make-listening-socket): Change from datagram sockets to stream
sockets because 'accept' is not a thing on datagram sockets and the
new tests care about that.  Also listen to the socket because a later
test needs that.
* fibers/io-wakeup.scm (with-read-waiting-is-failure,with-write-waiting-is-failure)
(make-read-operation,make-write-operation): Implement them.
This effectively merges wingo#60, with the following changes:

The commit ‘un-comment indices’ was in the future (time-wise)
and previously (commit history) mostly duplicated in:

commit 36a6cc7
Author: Ludovic Courtès <[email protected]>
Date:   Mon Feb 6 14:43:20 2023 +0100

    doc: Add index.

    * fibers.texi (Index): New node.

without mentioning the previous (time-wise) PR wingo#60.

The difference between the PR and this commit is that it appears
to merge the function and concept index.

Another difference: it's squashed.

* fibers.texi (Index): Don't mention concepts in the menu.
On old Guile versions, this makes the (cyclic) record actually
printable.  On both old and new Guile versions, this makes the
output much less verbose.

This is
<wingo#82> by cbaines, with the
proposal by davexunit implemented and with a test and news entry.

* fibers/scheduler.scm (<scheduler>): Set a printer.
* tests/basic.scm
("scheduler objects can be printed with a reasonable length:"): Test
it.
* NEWS: Mention it.
@emixa-d emixa-d force-pushed the scheduler-set-custom-record-printer branch from afa60a3 to 2f1060a Compare September 4, 2023 12:41
@emixa-d
Copy link
Collaborator

emixa-d commented Sep 4, 2023

Implemented davexunit's proposal.

@emixa-d
Copy link
Collaborator

emixa-d commented Sep 4, 2023

If CI succeeds, no negative review and I don't forget, I intend to merge it in a week.

@emixa-d emixa-d added enhancement approved Seems reasonable for merging, but let's give other people some time to comment. labels Sep 4, 2023
Looks like the conflicts in 1b0ce83
weren't fixed completely correctly.

* fibers.texi: Do it.
‘send-operation’ doesn't exist!

* fibers.texi (Context): Fix it.

Fixes: wingo#90
Reported-by: viviicat
Closes: wingo#48
Reported-by: cireu (with some adjustments)

* fibers/scheduler.scm (run-scheduler)[run-task]: Explain it.
@emixa-d emixa-d merged commit ce89657 into wingo:master Sep 14, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Seems reasonable for merging, but let's give other people some time to comment. enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants