[#43467] [Q] thread->interrupt_flag が適切に排他制御されていないように見える — KOSAKI Motohiro <kosaki.motohiro@...>

kosakiです

15 messages 2011/05/08
[#43482] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — SASADA Koichi <ko1@...> 2011/05/08

 ささだです.

[#43486] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — KOSAKI Motohiro <kosaki.motohiro@...> 2011/05/09

>  ささだです.

[#43487] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — SASADA Koichi <ko1@...> 2011/05/09

 ささだです.

[#43488] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — KOSAKI Motohiro <kosaki.motohiro@...> 2011/05/09

>  ささだです.

[#43489] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — KOSAKI Motohiro <kosaki.motohiro@...> 2011/05/09

自己解決しました

[#43500] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — SASADA Koichi <ko1@...> 2011/05/09

 ささだです.

[#43501] Re: [Q] thread->interrupt_flag が適切に排他制御されていないように見える — KOSAKI Motohiro <kosaki.motohiro@...> 2011/05/09

>> ということは危ないのは RUBY_VM_SET_INTERRUPT() がロストしたときに、タイムアウトなしの

[#43468] Re: [ruby-changes:19438] Ruby:r31478 (trunk): * test/date/*.rb: use skip /w messages. — KOSAKI Motohiro <kosaki.motohiro@...>

2011/5/8 tadf <[email protected]>:

8 messages 2011/05/08

[#43476] [Ruby 1.9 - Feature #4653][Open] [PATCH 1/1] new method Enumerable#rude_map — Shyouhei Urabe <shyouhei@...>

16 messages 2011/05/08

[#43493] [Ruby 1.9 - Feature #4657][Open] add option to hide skip messages on unit/test — Shota Fukumori <sorah@...>

11 messages 2011/05/09

[#43502] draft schedule of Ruby 1.9.3 — "Yuki Sonoda (Yugui)" <yugui@...>

-----BEGIN PGP SIGNED MESSAGE-----

23 messages 2011/05/09
[#43505] Re: draft schedule of Ruby 1.9.3 — "U.Nakamura" <usa@...> 2011/05/10

Hello,

[#43513] Re: draft schedule of Ruby 1.9.3 — KOSAKI Motohiro <kosaki.motohiro@...> 2011/05/10

(ruby-coreはずしました)

[#43587] [Ruby 1.9 - Feature #4788][Open] resolv.rb refactoring — Makoto Kishimoto <redmine@...>

15 messages 2011/05/27

[ruby-dev:43586] [Ruby 1.9 - Bug #4787][Open] Integer#each_modulo(n)

From: Kenta Murata <muraken@...>
Date: 2011-05-27 04:21:06 UTC
List: ruby-dev #43586
Issue #4787 has been reported by Kenta Murata.

----------------------------------------
Bug #4787: Integer#each_modulo(n)
http://redmine.ruby-lang.org/issues/4787

Author: Kenta Murata
Status: Open
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
Target version: 1.9.3
ruby -v: ruby 1.9.3dev (2011-05-27 trunk 31745) [x86_64-darwin10.7.0]


I suggest a new feature of Integer to enumerate by iterated Integer#modulo.
An example implementation in Ruby is the following code:

  class Integer
    def each_modulo(n)
      raise ArgumentError, "argument must be an Integer" unless n.is_a? Integer
      raise ArgumentError, "argument must be larger than 1" if n <= 1
      return Enumerator.new(self, :each_modulo, n) unless block_given?
      q = self
      while q > 0
        q, r = q.divmod(n)
        yield(r)
      end
    end
  end
  
  p 133.each_modulo(3).to_a #=> [1, 2, 2, 1, 1]

The following code is an example use of the feature:

  class Integer
    def each_thousand_separation
      each_modulo(1000)
    end
  
    def thousand_separated_string(sep=',')
      each_thousand_separation.map(&'%03d'.method(:%)).inject{|s, n| n + sep + s }
    end
  end
  
  p 100_000_000_200.thousand_separated_string #=> "100,000,000,200"

I make an implementation in C, and attach the patch for that.


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

In This Thread

Prev Next