I am pondering the question on how to achieve the following functionality 
elegantly in Julia:

1) I am reading camera parameters from an ini file into an object of type 
camera
2) I want to monitor the ini file that used to create the object for any 
changes .. lets say every second, and to update the object's internal 
parameters if a change occurred.

In C++ and in any other OO language that supports simple threading this is 
is a no-brainer , just define an internal class method for class camera 
that runs in a different thread and does just that
ie : polling for changes every second and updating accordingly. It is also 
very easy to make it thread-safe with an object lock.

What will be an elegant Julia equivalent?

One way is to define a function poll_threaded() that accepts object of type 
camera and starts a thread that monitor the filesystem for changes and 
updates if a change occurred,
The problem is that when the object is no longer referenced in the main 
application , the updating threaded function still holds a reference to it  
.. so effectively it will not get GCied

Any ideas?

Reply via email to