proc-wait3 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1852b4eba1bbe08fbc94c85af78d36e4d81c8872
4
- data.tar.gz: 3c153b9b4e4d764a35879862a1e29d4cbf8ad6c3
3
+ metadata.gz: 3e8e2adc295d743113110cd7ee38d0ccac0f3a4a
4
+ data.tar.gz: fa55f8271551d42e1c29192aa848f8e5804a924e
5
5
  SHA512:
6
- metadata.gz: 2874d8519a42b5d0ed2a6d2909bb484ee4bdb1f97dea4b8bd353c49cb3904f71adf7806c641336d49881d0a3f636e695116899bc3c2fea529580b66b3f655b4d
7
- data.tar.gz: 8060358bb72b80db9119310a6b80d675840154c69297b1d10ccdf4f3bac580059ec5625b0062d1cd4ac096c8e2896fb39422c6f415f89c6278cb8d513a500eee
6
+ metadata.gz: 72ba5b8d8c710346a44bf28ddf4e0ef0399e3e12e3687e5e0afd8bfb2ff5bbec4b984c92bdfb2aa88e3bee2e0bbccfeebe3b9ff41f6e8921dbc68cb7c23fa18c
7
+ data.tar.gz: 4d83c90b9b086c04547cf06e736e8739fa8cd00df46747d726e4b674e520a871ae542d83a596ae7cc2806acc5a391b7ff9eb64f486213de24c827987d5f189ad
data/CHANGES CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.7.2 - 5-Sep-2014
2
+ * Added support for the RUSAGE_THREAD constant on Linux. Thanks go to
3
+ Bruno Michel for the patch.
4
+
1
5
  == 1.7.1 - 24-Apr-2014
2
6
  * Explicitly check for and include sys/resource.h because Debian. Thanks
3
7
  go to Christos Trochalakis for the spot.
data/Rakefile CHANGED
@@ -39,7 +39,7 @@ namespace :gem do
39
39
  desc "Install the proc-wait3 gem"
40
40
  task :install => [:create] do |t|
41
41
  file = Dir['*.gem'].first
42
- sh "gem install #{file}"
42
+ sh "gem install -l #{file}"
43
43
  end
44
44
  end
45
45
 
@@ -92,4 +92,7 @@ have_const('P_PID', 'signal.h') || have_const('P_PID', 'sys/wait.h')
92
92
  have_const('P_PROJID', 'signal.h')
93
93
  have_const('P_TASKID', 'signal.h')
94
94
 
95
+ # RUSAGE_THREAD is Linux-specific
96
+ have_const('RUSAGE_THREAD', 'sys/resource.h')
97
+
95
98
  create_makefile('proc/wait3', 'proc')
@@ -730,6 +730,9 @@ static VALUE proc_sigsend(int argc, VALUE* argv, VALUE mod){
730
730
  * process. If +children+ is set to true, it will return information for
731
731
  * terminated and waited for children of the current process.
732
732
  *
733
+ * On Linux platforms the +children+ argument can be set to RUSAGE_THREAD to
734
+ * retrieve thread information instead.
735
+ *
733
736
  * The RUsage struct contains the following members:
734
737
  *
735
738
  * * utime - User time
@@ -758,7 +761,9 @@ static VALUE proc_getrusage(int argc, VALUE* argv, VALUE mod){
758
761
 
759
762
  rb_scan_args(argc, argv, "01", &v_children);
760
763
 
761
- if(RTEST(v_children))
764
+ if(TYPE(v_children) == T_FIXNUM)
765
+ who = FIX2INT(v_children);
766
+ else if(RTEST(v_children))
762
767
  who = RUSAGE_CHILDREN;
763
768
 
764
769
  if(getrusage(who,&r) == -1)
@@ -966,8 +971,12 @@ void Init_wait3()
966
971
  rb_define_const(rb_mProcess, "P_PROJID", INT2FIX(P_PROJID));
967
972
  #endif
968
973
 
969
- /* 1.7.1: The version of the proc-wait3 library */
970
- rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_new2("1.7.1"));
974
+ #ifdef HAVE_CONST_RUSAGE_THREAD
975
+ rb_define_const(rb_mProcess, "RUSAGE_THREAD", INT2FIX(RUSAGE_THREAD));
976
+ #endif
977
+
978
+ /* 1.7.2: The version of the proc-wait3 library */
979
+ rb_define_const(rb_mProcess, "WAIT3_VERSION", rb_str_new2("1.7.2"));
971
980
 
972
981
  /* Define this last in our Init_wait3 function */
973
982
  rb_define_readonly_variable("$last_status", &v_last_status);
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'proc-wait3'
5
- spec.version = '1.7.1'
5
+ spec.version = '1.7.2'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -33,7 +33,7 @@ class TC_Proc_Wait3 < Test::Unit::TestCase
33
33
  end
34
34
 
35
35
  test "version constant is set to expected value" do
36
- assert_equal('1.7.1', Process::WAIT3_VERSION)
36
+ assert_equal('1.7.2', Process::WAIT3_VERSION)
37
37
  end
38
38
 
39
39
  test "wait3 method is defined" do
@@ -165,6 +165,11 @@ class TC_Proc_Wait3 < Test::Unit::TestCase
165
165
  assert_nothing_raised{ Process.getrusage(true) }
166
166
  end
167
167
 
168
+ test "getrusage can get thread info on Linux" do
169
+ omit_unless(@@linux)
170
+ assert_nothing_raised{ Process.getrusage(Process::RUSAGE_THREAD) }
171
+ end
172
+
168
173
  test "getrusage returns the expected struct" do
169
174
  fork{ sleep 0.5 }
170
175
  assert_kind_of(Struct::RUsage, Process.getrusage)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proc-wait3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit