Comments (6)
Yes, I had a quick look and it looks similar to what I did.
from vdkqueue.
Actually NSThread retains its target, so _keepWatcherThreadRunning will never be set to NO in dealloc because dealloc will never be called while the thread is running.
However the same race condition will occur if you remove a path any other way since the removal is not synced with the thread.
from vdkqueue.
Holy hell, you’re totally right. Can’t believe I missed that. I can fix this in the next couple weeks, but if you’re willing to put together a PR I’d be happy to merge. Thanks!
On 24 Apr 2015, at 01:00, Peter N Lewis [email protected] wrote:
Actually NSThread retains its target, so _keepWatcherThreadRunning will never be set to NO in dealloc because dealloc will never be called while the thread is running.
However the same race condition will occur if you remove a path any other way since the removal is not synced with the thread.
—
Reply to this email directly or view it on GitHub #13 (comment).
from vdkqueue.
I'm afraid I have trouble with github and pullrequests. I am entirely vandalizing the code (there is not much left really) for my purposes, but my solution for this issue went something like this:
static ptrint_t gUniqueIndex = 1;
each entry gets a ptrint_t_uniqueIndex, initialized to gUniqueIndex++
Add another NSMutableDictionary mapping uniqueIndex to entries.
Put the uniqueIndex in the event data field.
In the thread, within the @syncronized, look up the event based on the uniqueIndex.
My code is 64-bit only, so unique index will never wrap so that is never an issue.
And the thread already references self in other places, so avoiding referencing self is pointless (just make sure to use the @synronized).
I'm sure there are many other solutions, but I generally dislike keeping unsafe unretained references to objects and prefer for this sort of thing to use a safe index that looks to see if the object is still alive.
I'm happy to email the (as I say, highly vandalised) code to you to look at if you like (peter at stairways.com.au), though I haven't actually finished and got it working yet so no real guarantees, but it can show my thinking.
from vdkqueue.
That’d be great. If you can send me a copy once you’re done with it, I’m @bdkjones on Twitter or bryan at incident 57 dot com.
On 24 Apr 2015, at 04:19, Peter N Lewis [email protected] wrote:
I'm afraid I have trouble with github and pullrequests. I am entirely vandalizing the code (there is not much left really) for my purposes, but my solution for this issue went something like this:
static ptrint_t gUniqueIndex = 1;
each entry gets a ptrint_t_uniqueIndex, initialized to gUniqueIndex++
Add another NSMutableDictionary mapping uniqueIndex to entries.
Put the uniqueIndex in the event data field.
In the thread, within the @syncronized https://github.com/syncronized, look up the event based on the uniqueIndex.
My code is 64-bit only, so unique index will never wrap so that is never an issue.
And the thread already references self in other places, so avoiding referencing self is pointless (just make sure to use the @synronized).
I'm sure there are many other solutions, but I generally dislike keeping unsafe unretained references to objects and prefer for this sort of thing to use a safe index that looks to see if the object is still alive.
I'm happy to email the (as I say, highly vandalised) code to you to look at if you like (peter at stairways.com.au), though I haven't actually finished and got it working yet so no real guarantees, but it can show my thinking.
—
Reply to this email directly or view it on GitHub #13 (comment).
from vdkqueue.
@peternlewis if you're still monitoring this, is the patch I just posted along the lines of what you were saying? I'm using it in a current project and it seems to be working ok...
from vdkqueue.
Related Issues (11)
- addPath: notifyingAbout Flag Issue HOT 2
- How to detect what are changed in the folder HOT 1
- crash calling a deallocated delegate, plus memory leak
- Compiler warnings HOT 5
- Fork with ARC and bugfixes: https://github.com/coeur/VDKQueue
- symbol(s) not found for architecture x86_64 HOT 6
- Question: Only seems to work for the first notification? HOT 1
- Licensing Issue: When being awesome isn't awesome HOT 3
- Leaks introduced when running against ARC code HOT 2
- Can not monitor a file HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vdkqueue.