# Thread Priority

**URL:** <https://www.ruby-forum.com/t/thread-priority/177844>\
**Category:** IronRuby\
**Created:** [October 25, 2009, 7:10am UTC](https://www.ruby-forum.com/t/thread-priority/177844 "2009-10-25T07:10:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 25, 2009, 7:10am UTC](https://www.ruby-forum.com/t/thread-priority/177844/1 "2009-10-25T07:10:33Z")

</div>

Hi guys,

I’ve just noticed that something happened to Thread.priority… It  
disappeared.  
I’m talking about Thread’s instance attribute - priority. I’m using  
the latest code from GitHub.

The only available priority in the Thread instance now is a CamelCase  
priority, which is .Net’s Priority attribute…

Take a look at the next REPL session:  
=\> #\<Thread:0x000005e aborting\>

> > > t = Thread.new { puts “Start”; sleep(30); puts “end” }  
> > > tart=\>  
> > > #\<Thread:0x0000060 run\>
> 
> > > t.priority  
> > > :0: undefined method `priority’ for #\<Thread:0x0000060 sleep\>  
> > > (NoMethodError)

> > > t.Priority  
> > > =\> Normal

I remember the priority attribute was problematic because it didn’t  
receive numeric values like MRI. Maybe this is related to that?

Thanks,  
Shay.

–

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 25, 2009, 5:57pm UTC](https://www.ruby-forum.com/t/thread-priority/177844/2 "2009-10-25T17:57:55Z")

</div>

Ruby Thread#priority is not implemented yet. We disabled name mangling  
on built-ins recently so Thread.Priority property is not callable via  
lower-case name anymore.

Tomas

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 25, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/thread-priority/177844/3 "2009-10-25T20:55:51Z")

</div>

Is it going to be implemented for V1?  
If yes, is it going to work as MRI with numeric values?

Thanks!  
Shay.

On 10/25/09, Tomas M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> To: ironruby-core  
> priority, which is .Net’s Priority attribute…
> 
> > > > t.Priority  
> > > > Shay F.  
> > > > removed\_email\_address@domain.invalid  
> > > > [http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)

–

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 26, 2009, 12:58am UTC](https://www.ruby-forum.com/t/thread-priority/177844/4 "2009-10-26T00:58:09Z")

</div>

Hello,

I have done a very basic implementation of a while back but I did not  
finish  
the modifications to the specs to test this.

Here are the commits if you want to grab it

> <https://github.com/PascalN2/ironruby/commit/3a0373379b79dbe7fff603ad61ab726d7>

de7f305

> <https://github.com/PascalN2/ironruby/commit/47f0de87e908981f553732e97f948a33b>

164f202

It was decided at some point that there would only be 5 valid values

-2, -1, 0, 1 and 2 … mapping to the CLR thread priorities  
Lowest, BelowNormal, Normal, AboveNormal and Highest

If anything lower than -2 is passed in the thread will be assigned  
Lowest  
and Highest if above 2.

Pascal

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 26, 2009, 3:02pm UTC](https://www.ruby-forum.com/t/thread-priority/177844/5 "2009-10-26T15:02:50Z")

</div>

Quick +1 to vote this patch up.

I’ve been working on the JRuby support for the DataMapper ORM and  
DataObjects(.rb) database connectivity layer. These projects rely in  
turn on another project called Extlib, which provides a bunch of  
useful extensions (lazy arrays, thread pools, string extensions) for  
the other two projects.

I pulled down and built the latest IronRuby and running Extlib’s  
specs, the lack of Thread#priority appears to be the first blocker in  
our support for IR.

Alex Coles

DataMapper: [GitHub - datamapper/dm-core: DataMapper - Core](http://github.com/datamapper/dm-core)  
DataObjects: [GitHub - datamapper/do: DataObjects](http://github.com/datamapper/do)  
Extlib: [GitHub - datamapper/extlib: General Ruby extensions for Merb](http://github.com/datamapper/extlib)

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [April 23, 2010, 6:54am UTC](https://www.ruby-forum.com/t/thread-priority/177844/6 "2010-04-23T06:54:22Z")

</div>

What’s the status of the DataMapper port? I was just trying to use it  
but  
couldn’t get the gem installed. I’m interested in helping get this  
working.  
What next steps are needed?

Thanks,

Ryan R.

Email: removed\_email\_address@domain.invalid  
LinkedIn: [http://www.linkedin.com/in/ryanriley](http://www.linkedin.com/in/ryanriley)  
Blog: [http://wizardsofsmart.net/](http://wizardsofsmart.net/)  
Twitter: @panesofglass  
Website: [http://panesofglass.org/](http://panesofglass.org/)

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [October 26, 2009, 6:35am UTC](https://www.ruby-forum.com/t/thread-priority/177844/7 "2009-10-26T06:35:16Z")

</div>

I remembered something like that. Thanks for pointing it out Pascal.

Is it going to be incorporated into V1 code?

Thanks!

Shay.

On Mon, Oct 26, 2009 at 1:49 AM, Pascal Normandin \<

---

<div class="post-metadata">

**Author:** ![shayfriedman](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbe5ce/32.png) [@shayfriedman](https://www.ruby-forum.com/u/shayfriedman)\
**Post date:** [April 23, 2010, 7:12am UTC](https://www.ruby-forum.com/t/thread-priority/177844/8 "2010-04-23T07:12:31Z")

</div>

I’m working on installing datamapper from the sources. However, I have  
to  
manually execute `ir -S gem install .\pkg\_.gem` each time after the gem  
is  
created. I’m getting this error:  
C:\Users\ryan\dev\extlib\>irake install  
‘irake’ is not recognized as an internal or external command,  
operable program or batch file.

C:\Users\ryan\dev\extlib\>ir -S rake install --trace  
(in C:/Users/ryan/dev/extlib)  
\*\* Invoke install (first\_time)  
\*\* Invoke build (first\_time)  
\*\* Invoke gemspec (first\_time)  
\*\* Invoke gemspec:generate (first\_time)  
\*\* Invoke version\_required (first\_time)  
\*\* Execute version\_required  
\*\* Execute gemspec:generate  
Generated: extlib.gemspec  
\*\* Invoke gemspec:validate (first\_time)  
\*\* Invoke version\_required  
\*\* Execute gemspec:validate  
extlib.gemspec is valid.  
\*\* Execute gemspec  
\*\* Execute build  
WARNING: description and summary are identical  
Successfully built RubyGem  
Name: extlib  
Version: 0.9.15  
File: extlib-0.9.15.gem  
\*\* Execute install  
Executing “ir install ./pkg/extlib-0.9.15.gem”:  
ir install ./pkg/extlib-0.9.15.gem  
unknown: Could not find file ‘C:\Users\ryan\dev\extlib\install’.  
(Errno::ENOENT)

rake aborted!  
Command failed with status (1): [ir install ./pkg/extlib-0.9.15.gem…]  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:1091:in `sh’  
C:/Users/ryan/.gem/ironruby/1.8/gems/jeweler-1.4.0/lib/jeweler/commands/install\_gem.rb:15:in  
`run' C:/Users/ryan/.gem/ironruby/1.8/gems/jeweler-1.4.0/lib/jeweler.rb:89:in `install\_gem’  
C:/Users/ryan/.gem/ironruby/1.8/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:77:in  
`define' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:636:in  
`execute' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:631:in  
`execute' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke\_with\_call\_chain’  
C:/Program Files (x86)/IronRuby 1.0/lib/ruby/1.8/monitor.rb:242:in  
`mon_synchronize' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke\_with\_call\_chain’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:583:in  
`invoke' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke\_task’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in  
`top_level' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in  
`top_level' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard\_exception\_handling’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in  
`top_level' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in  
`standard_exception_handling' C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run’  
C:/Users/ryan/.gem/ironruby/1.8/gems/rake-0.8.7/bin/rake:31  
C:/Users/ryan/.gem/ironruby/1.8/bin/rake:19:in `load’  
C:/Users/ryan/.gem/ironruby/1.8/bin/rake:19

Shouldn’t this both build the gem and execute gem install on the created  
gem? Did I miss a step?

Thanks!

Ryan R.

Email: removed\_email\_address@domain.invalid  
LinkedIn: [http://www.linkedin.com/in/ryanriley](http://www.linkedin.com/in/ryanriley)  
Blog: [http://wizardsofsmart.net/](http://wizardsofsmart.net/)  
Twitter: @panesofglass  
Website: [http://panesofglass.org/](http://panesofglass.org/)
