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

console: Allow for multiple subscribers #194

Merged
merged 3 commits into from
Oct 21, 2024
Merged

console: Allow for multiple subscribers #194

merged 3 commits into from
Oct 21, 2024

Conversation

reynir
Copy link
Contributor

@reynir reynir commented Oct 21, 2024

No description provided.

loop
let update s =
let s = Option.value ~default:[] s in
let s' = List.filter (fun (_v, _u, fd') -> fd <> fd') s in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just to be sure, we can compare file descriptors? I think it is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested with Unix.stdin = Unix.stdout and Unix.stdin = Unix.stdin. It worked fine in the toplevel. It would be nice to have somewhere to point to that says "it's safe to compare Unix.file_descras I rememberUnix.file_descr` being a bit special.

We can also have a counter that we use to generate IDs we compare with.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is fine to do. There's been here and there code to take the identifier (integer) of a fd -- but I guess we don't need that nor want to go down that route.

It'd indeed be nice if there was a Unix.compare_fd or Unix.equal_fd function provided by OCaml.

Copy link
Collaborator

@hannesm hannesm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@hannesm hannesm merged commit 0b59a94 into main Oct 21, 2024
10 of 13 checks passed
@hannesm hannesm deleted the multi-subscribers branch October 21, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants