Miyako, On Mon, Oct 31, 2016 at 10:16 PM, Keisuke Miyako <keisuke.miy...@4d.com> wrote:
> what if another process removed or changed elements while that process is > working its way though the IP array? > would that not become a problem? > What would be the difference between adding and deleting an element? Granted I didn't test that because I wanted an easy metric to measure but it seems like the same case - the actions appear to be queued by 4D. > > but the problem with multi-threaded access in compiled mode is more > serious; > you don't want another thread to use the same register while a thread is > in the middle of a read/write operation. > Absolutely, as I noted this is only in respect to a single client without multi-threading. > The "while" loop in your "Lock" method can be an over kill; > That's actually what got me thinking about it. I see it in a number of databases though. And if you were to carry this line of thought to it's logical conclusion such a lock is to ensure the variable will be written and accept nothing less - which you wouldn't want to do normally. I was surprised how little overhead that added. On my macBookPro the un-protected loops took about 2800ms and the protected ones about 3100ms, interpreted. It's not a significant performance issue in my view. -- Kirk Brooks San Francisco, CA ======================= ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************