On Sat, 27 Jan 2018 20:59:24 +0000, JiiPee <
n...@notvalid.com> wrote:
>On 27/01/2018 19:31, Robert Wessel wrote:
>> work directory looking
>> for a new file to read, release it when you've found and opened one
>> (for exclusive access).
>
>its only one file they are using common. Also how can the
>node.js/javascript check the mutex?
By itself it can't. As far as I'm aware, there's not a standard way
to call native code from JS, but many implementations have an
extension that allows that. Those may have installation and security
issues that you might not care to deal with, and, of course, they're
all different.
>But the writer is not allowed to write when the file is opened or before
>the file id deleted. So the release cannot happen after opening, but
>should happen after the file has been read+deleted.
>
>> Acquire it again just before the close and
>
>but between this the writer ccould write new data which is not good.
Never write to a file a second time. The writer creates a file,
writes to it, closes it. The reader scans the directory for matching
files, if it finds one, opens it and processes it and then deletes it.
When the writer has more to write, it creates another file (different
name), and the process repeats. If you need the reader to process the
data in the order the writer created it, include a timestamp or
counter in the filename and have the reader select the oldest.