-
Notifications
You must be signed in to change notification settings - Fork 3
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
Update for Janet 1.17 #1
Comments
Oh wow, do you actually use this? :P I never finished my blogging library so never got it to the point where I was relying on it :) |
I don't... yet :) But I am starting a new project that would benefit from it. Maybe the first step would be to extract the threaded parts from the basic bindings. |
Is the C interface for threads being deprecated? I compiled and ran this against the HEAD of master and while I get compilation warnings from Janet for my use of the If a rewrite is required, it looks to me like I'd probably want to use |
@subsetpark OK, so I rewrote the whole thing as a cleanly separated C library and Janet wrapper. The Janet wrapper no longer uses the thread module and instead does everything on the event loop. Basic functionality appears to work but I don't have a comprehensive test suite at this point. I also haven't written documentation yet, unfortunately. In case you wanted to play around with it, the idea now is that there are two ways to interact with the library, the easy way and the hard way:
Although the Janet wrapper runs on the event loop, the C library still uses a separate thread to do the monitoring itself. When an event is detected by that monitoring thread, the thread calls a callback that was provided when the monitor was created (together with some user-specified data that was also provided when the monitor was created). The callback defined by the Janet wrapper serialises the pertinent information about the event into a pipe that the watchful module is monitoring on the main thread via the Janet event loop. When the main thread receives the data through the pipe, it transforms it into the Janet struct and puts it into the channel. As Rube Golberg-esque as that might sound, I think this approach is preferable to what I was doing before. Oh, and it still only provides inotify and FSEvents backends. I would like at some point for there to be ReadDirectoryChangesW and kqueue backends but I want to be more confident the general approach is sound before attempting that. |
Janet 1.17 deprecates the old thread interface, meaning watchful fails to compile:
It might be a lot of work to rewrite this...
The text was updated successfully, but these errors were encountered: