[#15701] Ruby 1.9.0-1 snapshot released — Yukihiro Matsumoto <matz@...>
Hi,
[#15704] Proc#curry doesn't work on func which produces func — Lin Jen-Shin <godfat@...>
Proc#curry doesn't work on function which produces function,
Hi,
>>>>> "Y" == Yusuke ENDOH <mame@tsg.ne.jp> writes:
[#15707] Schedule for the 1.8.7 release — "Akinori MUSHA" <knu@...>
Hi, developers,
On Sat, Mar 01, 2008 at 08:58:00PM +0900, Akinori MUSHA wrote:
Hi,
At Fri, 21 Mar 2008 23:16:54 +0900,
At Mon, 24 Mar 2008 21:39:45 +0900,
[#15709] capitalize and downcase — Trans <transfire@...>
I've always wondered why String#capitalize downcases the whole string
[#15713] Ruby String hash key overflow when converting to Fixnum. — "Chiyuan Zhang" <pluskid@...>
Hi, all! I've opened a issue at rubyforge:
[#15728] Question on build process - skipping unsupported extensions — Daniel Berger <djberg96@...>
Hi,
[#15740] Copy-on-write friendly garbage collector — Hongli Lai <hongli@...99.net>
Hi.
Hi,
Yukihiro Matsumoto wrote:
Yukihiro Matsumoto wrote:
Hi.
Hongli Lai wrote:
Hi.
Hi,
I believe I managed to close the performance gap to only 6% slower than
Daniel DeLorme wrote:
[#15746] Am I misinterpreting the new keyword arguments to IO.foreach and friends? — Dave Thomas <dave@...>
I was expecting this to pass lines to the block:
[#15756] embedding Ruby 1.9.0 inside pthread — "Suraj Kurapati" <sunaku@...>
Hello,
Hi,
Hi,
Yukihiro Matsumoto wrote:
Suraj N. Kurapati wrote:
Hi,
Nobuyoshi Nakada wrote:
Suraj N. Kurapati wrote:
Hongli Lai wrote:
[#15775] next(n), succ(n) ? — Trans <transfire@...>
Can anyone see any reason against adding an optional parameter to
[#15778] Named captures and regular captures — Dave Thomas <dave@...>
It seems that once you have a named capture in a regular expression,
[#15783] Adding startup and shutdown to Test::Unit — Daniel Berger <Daniel.Berger@...>
Hi all,
Daniel Berger wrote:
On Wed, Mar 05, 2008 at 07:52:40AM +0900, Daniel Berger wrote:
[#15835] TimeoutError in core, timeouts for ConditionVariable#wait — MenTaLguY <mental@...>
I've been reworking JRuby's stdlib to improve performance and fix
On Sun, 2008-03-09 at 12:13 +0900, MenTaLguY wrote:
[#15837] Correct procedure for patch review? — Hongli Lai <hongli@...99.net>
Hi.
[#15855] Ruby 1.8.6 trace return line numbers wrong — "Rocky Bernstein" <rocky.bernstein@...>
Consider this program:
[#15860] Webrick directory traversal exploit on UNIX — Jos Backus <jos@...>
DSecRG Advisory #DSECRG-08-026 aka -018 describes a remote directory traversal
[#15871] Sparc architecture optimizations — Thomas Enebo <Thomas.Enebo@...>
Someone at Sun has been looking at Ruby on Sparc:
Thomas Enebo wrote:
Hello Ruby-core,
Hi,
Yukihiro Matsumoto wrote:
Prashant Srinivasan wrote:
[#15880] Ruby 1.8.6 binding value after "if" expression evaluation — "Rocky Bernstein" <rocky.bernstein@...>
Here's another trace hook weirdness that I've encountered.
Hello,
Thanks. The output you report matches what I get in 1.8.6 and suggests where
I think I've found why this is happening. The trace hook for NODE_IF is
[#15907] Range#member? semantics seem wrong — Dave Thomas <dave@...>
Range#member? has been changed so that it the start and end of the
[#15909] RARRAY_PTR — "Laurent Sansonetti" <laurent.sansonetti@...>
Hi,
[#15917] Ruby 1.9 (trunk) crashes when running RubyGems and Rake — Hongli Lai <hongli@...99.net>
Ruby 1.9 (trunk) seems to crash when running the supplied RubyGems and Rake:
Hi,
Nobuyoshi Nakada wrote:
On Mon, Mar 17, 2008 at 06:53:19PM +0900, Hongli Lai wrote:
[#15927] how to create a block with a block parameter in C? — Paul Brannan <pbrannan@...>
This works in Ruby (1.9):
>>>>> "P" == Paul Brannan <pbrannan@atdesk.com> writes:
[#15933] complex and rational — Dave Thomas <dave@...>
Before I start doing the documentation for the PickAxe, could I just
[#15936] Are Depreciated Methods "add_final" & "remove_final" supposed to ACTUALLY WORK? — Charles Thornton <ceo@...>
In Working on IRHG Docs for GC the following
>>>>> "C" == Charles Thornton <ceo@hawthorne-press.com> writes:
ts wrote:
[#15938] Questions on Enumerator#skip_first and Enumerable#first — "Artem Voroztsov" <artem.voroztsov@...>
I asked in ruby-talk, but did not get answer.
On Mar 18, 2008, at 6:20 AM, Artem Voroztsov wrote:
[#15975] Bugs in REXML — "Federico Builes" <federico.builes@...>
Hi,
On Mar 21, 2008, at 17:35, Federico Builes wrote:
[#15980] 1.8.6 memory leak? — "Stephen Sykes" <sdsykes@...>
Hi,
[#15983] Changing the algorithm of String#* — apeiros <apeiros@...>
Hi there
[#15990] Recent changes in Range#step behavior — "Vladimir Sizikov" <vsizikov@...>
Hi,
Hi Dave,
Hi Dave,
Hi,
Hi,
Hi,
On Wed, Mar 26, 2008 at 7:01 PM, Dave Thomas <dave@pragprog.com> wrote:
Dave Thomas wrote:
Dave Thomas wrote:
Dave Thomas wrote:
Dave,
This is all a semantic problem. Different people have different
[#16011] New ERb mode — Marc Haisenko <haisenko@...>
Hi folks,
On Tuesday 25 March 2008, Marc Haisenko wrote:
ERb already does this:
On Tuesday 25 March 2008, Jason Roelofs wrote:
On Tue, Mar 25, 2008 at 11:39 AM, Marc Haisenko <haisenko@comdasys.com> wro=
On Tuesday 25 March 2008, Jason Roelofs wrote:
[#16023] some Enumerable methods slower in 1.9 on OS X after revision 15124 — Chris Shea <cmshea@...>
All,
Hi,
Hi,
On Thu, Mar 27, 2008 at 02:26:51PM +0900, Nobuyoshi Nakada wrote:
Hi,
Nobuyoshi Nakada wrote:
Hi,
[#16057] About the license of gserver.rb being "freeware"? — "XiaoLiang Liu" <liuxlsh@...>
Hello everyone,
[#16088] command_call in parse.y — Adrian Thurston <thurston@...>
Hi,
Re: embedding Ruby 1.9.0 inside pthread
Suraj N. Kurapati wrote:
> Below is the revised (and more complex)
> example that better shows the Ruby/C interaction of my final program.
Whoops, the example had some redundant statements (in the Ruby
pthread body) that were never executed. Below is the corrected
code. Sorry for the confusion.
> One discrepancy I noticed is that this program works correctly with
> ruby-1.9.0-0 but crashes with the new ruby-1.9.0-1 release. For
> instance, here is the response when running with ruby-1.9.0-0:
The new response with ruby-1.9.0-0 is:
$ ./main.so
C program is calling RUBY_INIT_STACK()
C program is calling ruby_init()
C program is registering Object#relay_to_c method
C program is loading file: hello.rb
Ruby thread has been started, but is paused.
C program relaying to Ruby thread... 1st time
Ruby thread is starting interpreter...
rubygems OK!
{:$0=>"hello.rb"}
{:ARGV=>[]}
------------------------------------------------------------
Hello World! 0
C program relaying to Ruby thread... 2nd time
Hello World! 1
C program relaying to Ruby thread... 3rd time
Hello World! 2
C program relaying to Ruby thread... last time
Ruby thread is done, goodbye C program...
C program is back in control, exiting...
And with ruby-1.9.0-1 is:
$ ./main.so
C program is calling RUBY_INIT_STACK()
C program is calling ruby_init()
C program is registering Object#relay_to_c method
C program is loading file: hello.rb
Ruby thread has been started, but is paused.
C program relaying to Ruby thread... 1st time
Ruby thread is starting interpreter...
<dummy toplevel>:17: SystemStackError
Ruby thread is done, goodbye C program...
C program relaying to Ruby thread... 2nd time
[Control-C]
At this point, the C program is hung waiting for the Ruby thread
which has already terminated. So I had to kill it manually.
Why does ruby_run_node() cause a SystemStackError in ruby-1.9.0-1?
Is embedding ruby-1.9 inside a pthread no longer possible starting
from the ruby-1.9.0-1 release?
Thanks for your consideration.
---
Corrected example code:
$ cat hello.rb
require 'rubygems'
puts "rubygems OK!"
p :'$0' => $0
p :ARGV => ARGV
puts '-' * 60
3.times do |i|
puts "Hello World! #{i}"
relay_to_c
end
$ cat main.c
#include <stdio.h>
#include <pthread.h>
#include <ruby.h>
#include <stdbool.h>
pthread_t gRubyThread;
pthread_mutex_t gRubyLock;
pthread_cond_t gRubyCond;
bool gRubyRunning;
///
/// Transfers control from the Ruby script
/// to the C program and pauses Ruby.
///
VALUE relay_to_c(VALUE);
///
/// Transfers control from the Ruby thread
/// to the C program and pauses Ruby.
///
void relay_from_ruby_to_c();
///
/// Transfers control from the C program to
/// the Ruby thread and pauses the C program.
///
void relay_from_c_to_ruby();
///
/// Makes the C program wait until the Ruby
/// thread finishes running (for now).
///
void wait_for_ruby();
///
/// Tells the C program that the Ruby
/// thread has finished running (for now).
///
void ruby_is_done();
///
/// Makes the Ruby thread wait until the
/// C program finishes running (for now).
///
void wait_for_c();
///
/// Tells the Ruby thread that the C
/// program has finished running (for now).
///
void c_is_done();
///
/// Body of the pthread which hosts the
/// Ruby interpreter's flow of execution.
///
/// aRubyProgram:: program node for the interpreter to run
///
void* the_ruby_thread(void* aRubyProgram)
{
printf("Ruby thread has been started, but is paused.\n");
relay_from_ruby_to_c();
printf("Ruby thread is starting interpreter...\n");
ruby_run_node(aRubyProgram);
printf("Ruby thread is done, goodbye C program...\n");
ruby_is_done();
pthread_exit(NULL);
}
RUBY_GLOBAL_SETUP
void the_c_program()
{
char* file = "hello.rb"; // the file to run
int fake_argc = 2;
char* fake_args[fake_argc];
fake_args[0] = file; // $0 - name of the program
fake_args[1] = file;
char** fake_argv = fake_args;
printf("C program is calling RUBY_INIT_STACK()\n");
RUBY_INIT_STACK;
printf("C program is calling ruby_init()\n");
ruby_init();
printf("C program is registering Object#relay_to_c method\n");
rb_define_module_function(rb_cObject, "relay_to_c",
relay_to_c, 0);
printf("C program is loading file: %s\n", file);
void* rubyProgram = ruby_options(fake_argc, fake_argv);
pthread_mutex_init(&gRubyLock, NULL);
pthread_cond_init(&gRubyCond, NULL);
gRubyRunning = true;
pthread_create(&gRubyThread, NULL, the_ruby_thread, rubyProgram);
wait_for_ruby();
printf("C program relaying to Ruby thread... 1st time\n");
relay_from_c_to_ruby(); // C program blocks here
printf("C program relaying to Ruby thread... 2nd time\n");
relay_from_c_to_ruby(); // C program blocks here
printf("C program relaying to Ruby thread... 3rd time\n");
relay_from_c_to_ruby(); // C program blocks here
printf("C program relaying to Ruby thread... last time\n");
relay_from_c_to_ruby(); // C program blocks here
printf("C program is back in control, exiting...\n");
pthread_mutex_destroy(&gRubyLock);
pthread_cond_destroy(&gRubyCond);
}
int main(int argc, char** argv)
{
the_c_program();
return 0;
}
VALUE relay_to_c(VALUE self)
{
relay_from_ruby_to_c();
return self;
}
void relay_from_ruby_to_c()
{
ruby_is_done();
wait_for_c();
}
void ruby_is_done()
{
pthread_mutex_lock(&gRubyLock);
{
gRubyRunning = false;
pthread_cond_signal(&gRubyCond);
}
pthread_mutex_unlock(&gRubyLock);
}
void wait_for_c()
{
pthread_mutex_lock(&gRubyLock);
{
while (!gRubyRunning)
{
pthread_cond_wait(&gRubyCond, &gRubyLock);
}
}
pthread_mutex_unlock(&gRubyLock);
}
void relay_from_c_to_ruby()
{
c_is_done();
wait_for_ruby();
}
void c_is_done()
{
pthread_mutex_lock(&gRubyLock);
{
gRubyRunning = true;
pthread_cond_signal(&gRubyCond);
}
pthread_mutex_unlock(&gRubyLock);
}
void wait_for_ruby()
{
pthread_mutex_lock(&gRubyLock);
{
while (gRubyRunning)
{
pthread_cond_wait(&gRubyCond, &gRubyLock);
}
}
pthread_mutex_unlock(&gRubyLock);
}