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

Create Synchronzier module #360

Merged
merged 1 commit into from
Aug 6, 2024
Merged

Conversation

krtab
Copy link
Collaborator

@krtab krtab commented Jul 9, 2024

No description provided.

@krtab
Copy link
Collaborator Author

krtab commented Jul 9, 2024

Because Ocaml does not possess an optimizing compiler, we should check that this does not tank performances and manually add [@@inline] where needed to try and salvage what demands salvation.

@zapashcanon
Copy link
Member

Can you add a .mli ?

type ('get, 'write) t =
{ mutex : Mutex.t
; cond : Condition.t
; getter : unit -> 'get option
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The idea is that this is a closure that when called, gets one element to run, without caring for synchronization. Typically, for a Queue, this is fun () -> Queue.take_opt q, and for concolic this will be fun () -> find_node_to_run tree.

@krtab krtab force-pushed the synchronizer branch 2 times, most recently from 913631d to 94292bf Compare July 10, 2024 13:17
@krtab
Copy link
Collaborator Author

krtab commented Jul 10, 2024

Once this is effectively used in concollic, I'll add documentation and close #363

@zapashcanon
Copy link
Member

I'm asking for a .mli not only to add documentation but to make sure the interface is properly constrained to the things that are actually used outside (so that the compiler can tell us about unused stuff and the like).

@krtab
Copy link
Collaborator Author

krtab commented Jul 11, 2024

Yes, I have added a mli :)

match get q true with
| None -> ()
| Some v ->
let () = f v (fun v -> write v q) in
Copy link
Member

Choose a reason for hiding this comment

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

f v ...; was more idiomatic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But didn't constrain the return type to be unit.

@zapashcanon
Copy link
Member

Thanks!

@zapashcanon zapashcanon merged commit 22e4151 into OCamlPro:main Aug 6, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants