[MacRuby-devel] Thread safety in apply example?

Joshua Ballanco jballanc at gmail.com
Tue Jan 25 06:31:20 PST 2011


On Tue, Jan 25, 2011 at 3:13 AM, Charles Oliver Nutter
<headius at headius.com>wrote:

> On Tue, Jan 25, 2011 at 2:11 AM, Charles Oliver Nutter
> <headius at headius.com> wrote:
> > I did have to hack around the parser logic, since native extensions
> > largely mean death for concurrency on JRuby (and by native I mean C
> > extensions using MRI's API). Instead, I lifted code from Mongrel and
> > Rack to use Mongrel's parser to populate a Rack environment, and
> > managed to make the result function well enough to benchmark.
>
> I should clarify this... Mongrel has shipped a Java version of its
> Ragel-based parser for many years. JCD and ChaosBazaar have no
> native/C code whatsoever, and will run on any platform with a
> reasonably current JVM.
>
> I'd be happy to roll my CT/CB parser hackage back into mainline if we
> can find a clean way to isolate impl-specific backends. It would be
> easier to maintain a single CT atop multiple GCD lookalike APIs than
> to collaborate on largely-independent forks.


I agree. I'll think more about this later this evening, but for now I wanted
to quickly reply to mention Manfred Stienstra's beginning attempts at a
net/http rewrite (https://github.com/Manfred/Net-http2) including a
Ragel-based HTTP parser similar to that used by Mongrel. I had originally
played with the idea of using this instead of hooking up the parser on my
own, but in the end time-constraints won out. I should also mention that the
particular way in which ControlTower incorporates the parser via an Obj-C
class (instead of using the more vanilla Ruby C API) is partly a consequence
of the state of MacRuby when ControlTower was written, but mostly a result
of my own inexperience with the C API at the time.

So, yes, I think a more unified interface with a fast, reentrant,
standards-compliant HTTP parser would be a great thing for future server
developers and probably even the Ruby community as a whole.

- Josh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110125/30c99b82/attachment.html>


More information about the MacRuby-devel mailing list