Like the JavaScript version the core to the engine is a task class whose constructor is virtually identical except instead of process information it provides a function pointer to a routine that will process each file.  The task class is self contained and monolithic which is how I like to develop these small learning projects. At a later stage if I see any components that can be reused Ill refactor them into smaller units; even this process I regard a learning process and can be useful.

The inotify interface relies on events that are picked up through file reads; these can be either blocking or non-blocking. Initially the blocking version will be used and  the processing of any files handed over to a separate worker thread which is created for a class instance. File information will be queued by the read event loop for the worker thread to then pick up and process each file (a simple lock guard mutex will be used to control access to the queue). In effect this is just a simple producer/consumer model or to give  its modern ventricular pattern; with the read event loop producing file names and the worker thread consuming them to be processed.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s