japanese-goblinn / dekit Goto Github PK
View Code? Open in Web Editor NEWLibrary to watch changes in a directory
License: MIT License
Library to watch changes in a directory
License: MIT License
I want a clear API for my class so I've marked initializer with @discardableResult
if I only need to watch one directory for events. Only on the next morning (Yes, I've coded this at night ๐
) I've realized that this code can only work if there a retain cycle. So I've try to dig into memory graph, but I don't find any retain cycles, only kevents pointing to my class.
It's strange because they should disappear as soon as all directory files is no longer watched - but they don't. Main problem that I see here is that all watched files possibly will never be closed (because classes deinit
is never called) and it's definitely not good for memory usage.
deinit {
close(kernelQueue)
closeWatched()
}
private func closeWatched() {
// keys here is files descriptors
watchedFiles.keys.forEach { closeFile($0) }
close(watchedDirectory)
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.