Fair enough, thanks.

On Sep 15, 9:07 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> Not quite. Thread safety is also about not having two threads accessing the
> same file, frex.In general, Rhino DSL is thread safe. I am willing to
> sacrifice performance for simplicity, but things like the cache may be
> access concurrently, and thus has to be thread safe.
>
>
>
> On Tue, Sep 16, 2008 at 5:01 AM, webpaul <[EMAIL PROTECTED]> wrote:
>
> > That's kind of just defining thread safety, my question was more
> > whether you had defined that all aspects of Rhino DSL had to be thread
> > safe or whether you just did that for file access by default since a
> > file is somewhat of a "static" resource.
>
> > On Sep 14, 2:50 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > Anytime I want to modify an in memory data structure from potentially
> > > multiple threads.
>
> > > On Sun, Sep 14, 2008 at 7:24 PM, webpaul <[EMAIL PROTECTED]> wrote:
>
> > > > Do you do the read and write lock anytime you work with files or you
> > > > just know that this has to be thread safe? Just curious under what
> > > > circumstances you design for thread safety.
>
> > > > On Sep 13, 2:49 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > > > Yeah, that was the main issue.
>
> > > > > On Sat, Sep 13, 2008 at 3:48 PM, webpaul <[EMAIL PROTECTED]> wrote:
>
> > > > > > Ok, your mods are in the trunk so I was able to find them. Looks
> > like
> > > > > > thread safety was a concern among other things
>
> > > > > > On Sep 13, 12:38 am, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> > > > > > > Applied with some modifications, thanks.
>
> > > > > > > On Fri, Sep 12, 2008 at 7:33 AM, webpaul <[EMAIL PROTECTED]>
> > wrote:
>
> > > > > > > > Uploaded DSLCompileCache.patch
>
> > > > > > > > On Sep 11, 10:56 pm, "Ayende Rahien" <[EMAIL PROTECTED]>
> > wrote:
> > > > > > > > > Send it over, I would like to go over it in full
>
> > > > > > > > > On Fri, Sep 12, 2008 at 6:50 AM, webpaul <[EMAIL PROTECTED]
>
> > > > wrote:
>
> > > > > > > > > > Added these, let me know if you are patch ready
>
> > > > > > > > > >        [Test]
> > > > > > > > > >        public void engine_recompiles_on_script_add()
> > > > > > > > > >        {
> > > > > > > > > >            string scriptPath1 =
>
> > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
>
> > @"DslFactoryFixture\engine_recompiles_on_script_add1.boo"));
> > > > > > > > > >            File.WriteAllText(scriptPath1, "def doit1():\n
> > print
> > > > > > 1");
>
> > > > > > > > > >            string scriptPath2 =
>
> > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
>
> > @"DslFactoryFixture\engine_recompiles_on_script_add2.boo"));
> > > > > > > > > >            File.WriteAllText(scriptPath2, "def doit2():\n
> > print
> > > > > > 2");
>
> > > > > > > > > >            string cachePath1 = null, cachePath2 = null;
>
> > > > > > > > > >            try
> > > > > > > > > >            {
> > > > > > > > > >                engine.Compile(scriptPath1);
> > > > > > > > > >                Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > >                cachePath1 =
> > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
>
> > > > > > > > > >                engine.Compile(scriptPath1, scriptPath2);
> > > > > > > > > >                Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > >                cachePath2 =
> > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
> > > > > > > > > >            }
> > > > > > > > > >            finally
> > > > > > > > > >            {
> > > > > > > > > >                CleanupFiles(cachePath1, cachePath2,
> > > > scriptPath1,
> > > > > > > > > > scriptPath2);
> > > > > > > > > >            }
> > > > > > > > > >        }
>
> > > > > > > > > >        [Test]
> > > > > > > > > >        public void engine_recompiles_on_script_remove()
> > > > > > > > > >        {
> > > > > > > > > >            string scriptPath1 =
>
> > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
>
> > @"DslFactoryFixture\engine_recompiles_on_script_remove1.boo"));
> > > > > > > > > >            File.WriteAllText(scriptPath1, "def doit1():\n
> > print
> > > > > > 1");
>
> > > > > > > > > >            string scriptPath2 =
>
> > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
>
> > @"DslFactoryFixture\engine_recompiles_on_script_remove2.boo"));
> > > > > > > > > >            File.WriteAllText(scriptPath2, "def doit2():\n
> > print
> > > > > > 2");
>
> > > > > > > > > >            string cachePath1 = null, cachePath2 = null;
>
> > > > > > > > > >            try
> > > > > > > > > >            {
> > > > > > > > > >                engine.Compile(scriptPath1, scriptPath2);
> > > > > > > > > >                Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > >                cachePath1 =
> > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
>
> > > > > > > > > >                engine.Compile(scriptPath1);
> > > > > > > > > >                Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > >                cachePath2 =
> > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
> > > > > > > > > >            }
> > > > > > > > > >            finally
> > > > > > > > > >            {
> > > > > > > > > >                CleanupFiles(cachePath1, cachePath2,
> > > > scriptPath1,
> > > > > > > > > > scriptPath2);
> > > > > > > > > >             }
> > > > > > > > > >        }
>
> > > > > > > > > > On Sep 11, 10:34 pm, webpaul <[EMAIL PROTECTED]> wrote:
> > > > > > > > > > > The second test changes the script, it overwrites it with
> > a
> > > > new
> > > > > > > > value.
> > > > > > > > > > > The way the checksum works addition and deletion will
> > trigger
> > > > a
> > > > > > > > > > > recompile but I'll add a test to be sure.
>
> > > > > > > > > > > On Sep 11, 10:25 pm, "Ayende Rahien" <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > > > > > > > > script additionscript removal
> > > > > > > > > > > > changing the DSL itself (not sure how to change that)
>
> > > > > > > > > > > > On Fri, Sep 12, 2008 at 6:23 AM, webpaul <
> > > > [EMAIL PROTECTED]>
> > > > > > > > wrote:
>
> > > > > > > > > > > > > Ok, all tests green, here are the two I added. Let me
> > > > know if
> > > > > > you
> > > > > > > > > > > > > think additional scenarios need to be covered.
>
> > > > > > > > > > > > >        [Test]
> > > > > > > > > > > > >        public void engine_reuses_first_compile()
> > > > > > > > > > > > >        {
> > > > > > > > > > > > >            string path =
>
> > > > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
> > > > > > > > > > > > > @"DslFactoryFixture\MyFirstCustom.boo"));
> > > > > > > > > > > > >            File.WriteAllText(path, "print 0");
>
> > > > > > > > > > > > >            try
> > > > > > > > > > > > >            {
> > > > > > > > > > > > >                engine.Compile(path);
>
> > > >  Assert.IsFalse(engine.IsLastCompileCached);
>
> > > > > > > > > > > > >                engine.Compile(path);
>
> >  Assert.IsTrue(engine.IsLastCompileCached);
> > > > > > > > > > > > >            }
> > > > > > > > > > > > >            finally
> > > > > > > > > > > > >            {
> > > > > > > > > > > > >                //clean up cached output so next test
> > is
> > > > clean
> > > > > > > > > > > > >                string filePath =
> > > > > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
> > > > > > > > > > > > >                if (File.Exists(filePath))
> > > > > > > > > > > > >                    File.Delete(filePath);
>
> > > > > > > > > > > > >                if (File.Exists(path))
> > > > > > > > > > > > >                    File.Delete(path);
> > > > > > > > > > > > >            }
> > > > > > > > > > > > >        }
>
> > > > > > > > > > > > >        [Test]
> > > > > > > > > > > > >        public void
> > engine_recompiles_on_script_change()
> > > > > > > > > > > > >        {
> > > > > > > > > > > > >            string path =
>
> > > > Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,
> > > > > > > > > > > > > @"DslFactoryFixture\MyCustom.boo"));
> > > > > > > > > > > > >            string filePath1 = null, filePath2 = null;
>
> > > > > > > > > > > > >            try
> > > > > > > > > > > > >            {
> > > > > > > > > > > > >                File.WriteAllText(path, "print 1");
> > > > > > > > > > > > >                engine.Compile(path);
>
> > > >  Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > > > > >                filePath1 =
> > > > > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
>
> > > > > > > > > > > > >                File.WriteAllText(path, "print 2");
> > > > > > > > > > > > >                engine.Compile(path);
>
> > > >  Assert.IsFalse(engine.IsLastCompileCached);
> > > > > > > > > > > > >                filePath2 =
> > > > > > > > > > > > > engine.CompilerContextCache.LastCachedFilePath;
> > > > > > > > > > > > >            }
> > > > > > > > > > > > >            finally
> > > > > > > > > > > > >            {
> > > > > > > > > > > > >                //clean up cached output so next test
> > is
> > > > clean
> > > > > > > > > > > > >                if (File.Exists(filePath1))
> > > > > > > > > > > > >                    File.Delete(filePath1);
>
> > > > > > > > > > > > >                if (File.Exists(filePath2))
> > > > > > > > > > > > >                    File.Delete(filePath2);
>
> > > > > > > > > > > > >                //cleanup dynamic script
> > > > > > > > > > > > >                if (File.Exists(path))
> > > > > > > > > > > > >                    File.Delete(path);
> > > > > > > > > > > > >             }
> > > > > > > > > > > > >        }
>
> > > > > > > > > > > > > On Sep 11, 9:58 pm, webpaul <[EMAIL PROTECTED]>
> > wrote:
> > > > > > > > > > > > > > Ok, nevermind file locking issue resolved onto the
> > > > caching.
>
> ...
>
> read more »- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to