<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel about="http://permalink.gmane.org/gmane.comp.lang.ruby.core">
    <title>gmane.comp.lang.ruby.core</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19601"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19600"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19599"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19598"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19597"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19596"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19595"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19594"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19593"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19592"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19591"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19590"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19589"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19588"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19587"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19586"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19585"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19584"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19583"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19582"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19601">
    <title>[ruby-core:20290] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19601</link>
    <description>
It would still require changes to autoload so that before autoload had 
started but after the autoload constant had been encountered another 
thread would not have any chance to see a totally empty constant. 
autoload either needs to leave the autoload marker there or put some 
other marker there.

The ability to affect concurrency from within the autoloaded file hinges 
on the same requirement, as does a callback.

- Charlie


</description>
    <dc:creator>Charles Oliver Nutter</dc:creator>
    <dc:date>2008-12-04T04:09:08</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19600">
    <title>[ruby-core:20289] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19600</link>
    <description>
On Dec 3, 2008, at 9:55 PM, James Gray wrote:


That's a new thread, so the mutex.lock in its require will hang until  
any outer level one is done


</description>
    <dc:creator>Dave Thomas</dc:creator>
    <dc:date>2008-12-04T04:08:58</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19599">
    <title>[ruby-core:20288] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19599</link>
    <description>
autoload is a little trickier than that since it needs some intermediate 
state that isn't totally undefined but doesn't show up as 
yet-to-be-autoloaded either. But yeah, if we're willing to expect that 
require and autoload are one-thread-at-a-time, a lot of problems go away.

I'd say load could potentially be unsynchronized, since it's more 
explicit and doesn't make any guarantees about whether it will fire 
twice, etc. But perhaps it should just be done across the board.

- Charlie


</description>
    <dc:creator>Charles Oliver Nutter</dc:creator>
    <dc:date>2008-12-04T04:05:48</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19598">
    <title>[ruby-core:20287] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19598</link>
    <description>
I don't think this is really any different than having a single mutex 
for all requires. The requiring thread would acquire it for the duration 
of the require. Any additional requires it runs into it would still have 
the lock for. Any other threads doing requires would block until that 
thread had come all the way back out.

This implies a few things you should not do:

* Don't do long or blocking operations during script loads
* Don't launch threads that will do additional requires during script 
loads (or at least don't depend on them doing their requires until the 
launching thread has finished its own)

This obviously means requiring becomes a single-threaded process, which 
is probably the only way to make it completely safe.

- Charlie


</description>
    <dc:creator>Charles Oliver Nutter</dc:creator>
    <dc:date>2008-12-04T04:01:36</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19597">
    <title>[ruby-core:20286] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19597</link>
    <description>

I loved your let's-move-on post so much it actually pains me to write  
this, but can we be totally sure of that?

   Thread.new do
     require "i_so_hope_im_wrong_about_this"
   end

James Edward Gray II


</description>
    <dc:creator>James Gray</dc:creator>
    <dc:date>2008-12-04T03:55:59</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19596">
    <title>[ruby-core:20285] Re: [Bug #805] Ruby 1.9.1 preview 2 : build failure on OpenSolaris</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19596</link>
    <description>Hi,

At Thu, 4 Dec 2008 12:15:03 +0900,
Dae San Hwang wrote in [ruby-core:20284]:

Hmmm, they obviously conflict.



I guess so.  Could you tell how/from where those headers are
included?

</description>
    <dc:creator>Nobuyoshi Nakada</dc:creator>
    <dc:date>2008-12-04T03:39:08</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19595">
    <title>[ruby-core:20284] Re: [Bug #805] Ruby 1.9.1 preview 2 : build failure on OpenSolaris</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19595</link>
    <description>I've checked system header files and found following macro definitions  
of ISPRINT.


/* in "/usr/include/readline/chardefs.h" */

#define ISPRINT(c)      (IN_CTYPE_DOMAIN (c) &amp;&amp; isprint (c))


/* in "/usr/include/sys/euc.h" */

#define ISPRINT(c, wp)  (wp._multibyte &amp;&amp; !ISASCII(c) || isprint(c))


I guess the second definition of ISPRINT macro clashes with ruby?

daesan


On Dec 2, 2008, at 4:42 PM, Nobuyoshi Nakada wrote:




</description>
    <dc:creator>Dae San Hwang</dc:creator>
    <dc:date>2008-12-04T03:15:03</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19594">
    <title>[ruby-core:20283] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19594</link>
    <description>
On Dec 3, 2008, at 8:40 PM, hemant wrote:


I don't see how there could be a deadlock: once you've claimed the  
mutex, your thread is the one that will do requires. Any requires  
nested inside the original one will be executed in the same thread, so  
simply rescue and ignore the recursive lock exception.


Honestly, folks, I really don't see what all the fuss is about. One  
mutex, claimed by autoload, require, and load, will do the trick. If  
autoload claims it, then it gets to do the requires if it needs to,  
because they'll operate in-thread. If require claims it, then only  
requires and autoloads in that same thread will run until the original  
require finishes. Etc etc... No deadlock, and no contention.

The current MRI implementation has a bug. Fix it with a mutex, and it  
all gets better.

Then we find the next global thing that's not thread safe... :)


Dave


</description>
    <dc:creator>Dave Thomas</dc:creator>
    <dc:date>2008-12-04T02:55:38</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19593">
    <title>[ruby-core:20282] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19593</link>
    <description>

Why not use const_missing for lazy loading and protect "require" by a
mutex (there could be a deadlock, if requires are nested, but in
practice I was assuming it can be avoided)


</description>
    <dc:creator>hemant</dc:creator>
    <dc:date>2008-12-04T02:40:39</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19592">
    <title>[ruby-core:20281] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19592</link>
    <description>If the thread autoloading the file required another file, it's still the 
same thread.

Tomas Matousek wrote:



</description>
    <dc:creator>Charles Oliver Nutter</dc:creator>
    <dc:date>2008-12-04T02:40:37</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19591">
    <title>[ruby-core:20280] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19591</link>
    <description>A stupid idea that just came to mind (maybe someone already mentioned
it, I did not read all the messages):
Wouldn't being able to have autoload managed by a callback a nice
idea? It would allow the frameworks to implement it their own way...

Just my 2 cents


</description>
    <dc:creator>Vincent Isambart</dc:creator>
    <dc:date>2008-12-04T01:12:50</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19590">
    <title>[ruby-core:20279] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19590</link>
    <description>
looks like this has been discussed before [on the todo list since 2000 [1]].

Another "band aid" style option might perhaps be to allow the 'load'
file to know which autoload constant triggered it, then it could do
its own concurrency.
ex:
autoload_new :ConstantName, 'thread_safe_require'
then when autoload kicks in, it sets "something" [$something,
whatever] to 'ConstantName'
then
'thread_safe_require' would be able to hopefully load it sanely, if so desired.

Perhaps create new functions load_thread_safe and/or maybe
require_thread_safe :)

Thoughts?

-=R
[1] http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/4589


</description>
    <dc:creator>Roger Pack</dc:creator>
    <dc:date>2008-12-04T00:56:43</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19589">
    <title>[ruby-core:20278] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19589</link>
    <description>

Loading code right now is a depth-first search of the dependency tree for 
the required file. Your suggestion would change it to a breadth first 
search. As a result, the following example would try to inherit from Bar 
before Bar was defined, something that is not the case now. If you extend 
that to Kernel#require and not just Kernel#autoload, as you say, then 
most currently existing Ruby code would break because of this.

$ cat a.rb
Kernel.autoload(:Foo,'b')
Foo.something

$ cat b.rb
Kernel.autoload(:Bar,'c')
class Foo &lt; Bar
  def self.something
    puts "FizzBang"
  end
end

$cat c.rb
class Bar
end


</description>
    <dc:creator>Ken Bloom</dc:creator>
    <dc:date>2008-12-04T00:32:30</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19588">
    <title>[ruby-core:20277] [Bug #814] NoMethodError: undefined method `read_nonblock' for #&lt;OpenSSL::SSL::SSLSocket:0x1a64f9a0&gt;</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19588</link>
    <description>Issue #814 has been updated by Aaron Patterson.

File better.patch added

Here is an even better patch.  With tests.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/814

----------------------------------------
http://redmine.ruby-lang.org


</description>
    <dc:creator>Aaron Patterson</dc:creator>
    <dc:date>2008-12-03T23:57:06</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19587">
    <title>[ruby-core:20276] Re: Tail recursion?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19587</link>
    <description>is it a compiler directive? [or used to be?]
-=R

On Wed, Dec 3, 2008 at 2:47 PM, Robert Dober &lt;robert.dober&lt; at &gt;gmail.com&gt; wrote:



</description>
    <dc:creator>Roger Pack</dc:creator>
    <dc:date>2008-12-03T23:45:19</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19586">
    <title>[ruby-core:20275] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19586</link>
    <description>On Tue, Dec 2, 2008 at 11:10 PM, Charles Oliver Nutter
&lt;charles.nutter&lt; at &gt;sun.com&gt; wrote:

That might be a great idea.  The only drawback being if you have
file2.rb:
  sleep

run this:

Thread.new { sleep 1; require 'file1'}
require 'file2'

So if one thread is "happily running" within a require file [rails
does this?] then other threads would be prohibited from requiring.

Or I guess it could be mutex-ified per autoload [like require is
currently for 1.9]--i.e. when a second thread loads the same constant,
have it wait till the first's auto-load returns [somewhat of a
band-aid, but...hmm this is hard].

-=R


</description>
    <dc:creator>Roger Pack</dc:creator>
    <dc:date>2008-12-03T23:44:29</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19585">
    <title>[ruby-core:20274] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19585</link>
    <description>
Yes, I'd forgotten for a moment about the deadlock issue.
Thanks for reminding me. 

One way to avoid the deadlocks might be to dedicate a 
thread to servicing all requests to load new code.  Require and 
constant resolution with "autoload" enabled would be redefined
to queue code load requests.   The code "loader" thread would remove such
requests from the queue, then load the required ruby files (including
other files required by the requested file) while the
requesting thread waited remained blocked.
The loader thread would release the requesting thread only after
 its require request had been satisfied.

This single code loader thread thus serializes the otherwise
ill behaved concurrent Ruby code loading.

There are some details I'm (knowingly) omitting.
Does anyone see any truck sized holes in this general idea?

- brent



Jim Weirich-2 wrote:

</description>
    <dc:creator>Brent Roman</dc:creator>
    <dc:date>2008-12-03T21:58:54</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19584">
    <title>[ruby-core:20273] Tail recursion?</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19584</link>
    <description>Hi list

I was just having some real fun with the 191p2 and somehow I was sure
that tail recursion would be optimized away, but alas....
I than searched the list for any information on that and did not find anything.
Did I only dream or am I correct in assuming that Ruby1.9 will
eventually optimize tail recursions?

Thx in advance

Cheers
Robert

</description>
    <dc:creator>Robert Dober</dc:creator>
    <dc:date>2008-12-03T21:47:20</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19583">
    <title>[ruby-core:20272] Re: Promising C coding techniques to reduce MRI's memory use</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19583</link>
    <description>Hello,

On Wednesday 03 December 2008 19:47:01 Brent Roman wrote:

I'll definitely try it out, too.
Actually that's not exact, according to my experiments - it optimizes away 
assignments of NULL to a pointer. VALUE is not a pointer, and it doesn't 
optimize away neither NULL nor 0 assignments (i tried with gcc 4.3.2)

Coincidently, GCC 4.4 is supposed to have an optimization for variables in 
switch (see http://gcc.gnu.org/gcc-4.4/changes.html), but unfortunately, if i 
understand it correctly it's for constants only (i wonder if it's impossible 
for variables, or just nobody has written it yet :)

Regards,
</description>
    <dc:creator>Michal Babej</dc:creator>
    <dc:date>2008-12-03T20:42:27</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19582">
    <title>[ruby-core:20271] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19582</link>
    <description>Because of this problem, we *will* be removing the use of autoload in 1.1.
However, this is still a pretty big bug in Ruby itself (since it makes
autoload broken).
</description>
    <dc:creator>Yehuda Katz</dc:creator>
    <dc:date>2008-12-03T19:44:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.lang.ruby.core/19581">
    <title>[ruby-core:20270] Re: autoload and concurrency</title>
    <link>http://permalink.gmane.org/gmane.comp.lang.ruby.core/19581</link>
    <description>Unless the file that’s being auto-loaded requires another file via regular 'require' call.
Then you might have two different constants in the system being accessed concurrently by 2 threads each auto-loading a file that requires other files.

Tomas

-----Original Message-----
From: Charles.O.Nutter&lt; at &gt;sun.com [mailto:Charles.O.Nutter&lt; at &gt;sun.com] On Behalf Of Charles Oliver Nutter
Sent: Wednesday, December 03, 2008 6:52 AM
To: ruby-core&lt; at &gt;ruby-lang.org
Subject: [ruby-core:20259] Re: autoload and concurrency

Except that my proposed fix for autoload would have all secondary
threads either seeing the final loaded constant value or waiting on the
in-progress load; there would be no concurrent call to require whatsoever.

Tomas Matousek wrote:



</description>
    <dc:creator>Tomas Matousek</dc:creator>
    <dc:date>2008-12-03T19:04:48</dc:date>
  </item>
  <textinput about="http://search.gmane.org/?group=$group=gmane.comp.lang.ruby.core">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.lang.ruby.core</link>
  </textinput>
</rdf:RDF>
