One thing you might want to do using this process is to wait a period of time 
before trying to read or write to said file. Unix based operating systems will 
create a placeholder file prior to writing the actual file so that another 
process cannot use that filename in the middle of a write operation. I suppose 
you can also try to open the file for write even if you only want to read, 
which the OS will not allow while it is writing to it.

Bob S


On Nov 7, 2015, at 10:58 , Richard Gaskin 
<ambassa...@fourthworld.com<mailto:ambassa...@fourthworld.com>> wrote:

PS - a pleasant timing surprise:

One of the things I was testing this morning was the CPU impact of frequently 
polling for the existence of a file.  I have two processes which (for reasons 
not worth getting into here) can't talk via sockets, so I wondered how 
inefficient it might be to have them communicate via files.  Turns out checking 
for the existence of a specified file isn't bad at all.

Testing a worst-case I polled every millisecond and it never chewed up more 
than 4% of CPU time.  Throttling back to a more reasonable 500 ms never 
registered higher than 0%.

Not sure how well that would work on Windows, but OS X and Linux file system 
caching seems to make even brute force solutions like polling pretty nice.

--
Richard Gaskin

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to