Ruby_critical

Hello all

Can anyone tell me about RUBY_CRITICAL(). I want to know what this
function is about and what it does and whats the reason of ruby calling
this function?

Regards

Tridib

On Mon, Jan 30, 2012 at 8:09 PM, Tridib B.
[email protected]wrote:

Hello all

Can anyone tell me about RUBY_CRITICAL(). I want to know what this
function is about and what it does and whats the reason of ruby calling
this function?

it’s a ruby c function. There doesn’t seem to be much in the way of
documentation. Why not pull the ruby source code and read what the
function
does?

Andrew McElroy

Hi Andrew and Tridib,

On 31/01/12 13:21, andrew mcelroy wrote:

does?
Out of interest, I just did that, and in 1.9.2 at least, it is defined
twice, with no comments, with the form:

#define RUBY_CRITICAL(expr) do { expr; } while(0)

And all references are in win32.c.

Eep. :}

I’d hazard a guess that it does absolutely nothing at all (apart from
running the supplied expression/command) in the 1.9.2 release. Perhaps
it is a relic that has since been disabled, or it is to cover code that
has not yet been written? I’m now somewhat curious about this as well.
Since one reference is in a backward compat header, I’d put my money is
on the former.

I wonder if somebody knows?

Garth

Hi Andrew and Tridib,

Okay, some more info:

Ruby 1.8.7 wraps the statements in rb_w32_enter_critical() and
wb_w32_leave_critical(). With 1.9.2 doing nothing special with the
statements, my money is on the 1.9.2 series either no longer needing, or
no longer having, these particular calls.

I haven’t dug into which releases in-between do and don’t have these
extra calls, but this might be an angle to explore if investigating the
RUBY_CRITICAL macro.

Garth

unsubscribe

On Tue, Jan 31, 2012 at 10:08 AM, Garthy D <

On Tue, Jan 31, 2012 at 3:13 AM, Garthy D <
[email protected]> wrote:

I haven’t dug into which releases in-between do and don’t have these extra
calls, but this might be an angle to explore if investigating the
RUBY_CRITICAL macro.

I bet this is windows specific legacy code then.
EnterCriticalSection function was a windows 2000 call to handle low
memory
situations.
It would make sense that you wouldn’t want ruby to crash due to a low
memory flux while
virtual memory was being allocated.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682608(v=vs.85).aspx

It very well might just be a relic. If windows memory management bugs
are
still of concern,
then maybe this would be an excellent candidate for a ruby gem.

Andrew McElroy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs