sendfile 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 99bf77c10be057479085f39557a8d5a9e7a57ea1
4
+ data.tar.gz: 32f90f06d5a2df0f25f92e3a8215c9232f0c83f7
5
+ SHA512:
6
+ metadata.gz: 8a65bce7d54943340d88b032142b308b4c1159de89b19c5f320860d1ca3815fb43e264b02d9fd22661debec1abab94f481c61325359db28e263efa60b86abf11
7
+ data.tar.gz: 7f528d7819de5e365e83337adccaa3c4f61e652eb6ba893837e43fd4e06e4ba62785ada754171ba4707e5dfa4d6962a8cf3e83c36f96406c1fa5a1fc1aa7013a
@@ -52,5 +52,7 @@ f.print <<EOF
52
52
  EOF
53
53
  end
54
54
 
55
- have_func('rb_thread_blocking_region')
55
+ unless have_func('rb_thread_call_without_gvl', 'ruby/thread.h')
56
+ have_func('rb_thread_blocking_region')
57
+ end
56
58
  create_makefile( "sendfile")
@@ -45,7 +45,17 @@
45
45
  #include "config.h"
46
46
  static VALUE sym_wait_writable;
47
47
 
48
- #ifndef HAVE_RB_THREAD_BLOCKING_REGION
48
+ #if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) && defined(HAVE_RUBY_THREAD_H)
49
+ /* Ruby 2.0+ */
50
+ # include <ruby/thread.h>
51
+ typedef void * (*my_blocking_fn_t)(void*);
52
+ # define WITHOUT_GVL(fn,a) \
53
+ rb_thread_call_without_gvl((my_blocking_fn_t)(fn),(a),RUBY_UBF_IO,0)
54
+ #elif defined(HAVE_RB_THREAD_BLOCKING_REGION) /* Ruby 1.9 */
55
+ typedef VALUE (*my_blocking_fn_t)(void*);
56
+ # define WITHOUT_GVL(fn,a) \
57
+ rb_thread_blocking_region((my_blocking_fn_t)(fn),(a),RUBY_UBF_IO,0)
58
+ #else /* MRI 1.8 threads */
49
59
  /*
50
60
  * For non-natively threaded interpreters, do not monopolize the
51
61
  * process and send in smaller chunks. 64K was chosen as it is
@@ -57,13 +67,9 @@ static VALUE sym_wait_writable;
57
67
 
58
68
  /* (very) partial emulation of the 1.9 rb_thread_blocking_region under 1.8 */
59
69
  # include <rubysig.h>
60
- # define RUBY_UBF_IO ((rb_unblock_function_t *)-1)
61
- typedef void rb_unblock_function_t(void *);
62
70
  typedef VALUE rb_blocking_function_t(void *);
63
71
  static VALUE
64
- rb_thread_blocking_region(
65
- rb_blocking_function_t *fn, void *data1,
66
- rb_unblock_function_t *ubf, void *data2)
72
+ WITHOUT_GVL(rb_blocking_function_t *fn, void *data1)
67
73
  {
68
74
  VALUE rv;
69
75
 
@@ -73,7 +79,9 @@ rb_thread_blocking_region(
73
79
 
74
80
  return rv;
75
81
  }
76
- #else
82
+ #endif /* WITHOUT_GVL definitions */
83
+
84
+ #ifndef MAX_SEND_SIZE
77
85
  /*
78
86
  * We can release the GVL and block as long as we need to.
79
87
  * Limit this to the maximum ssize_t anyways, since 32-bit machines with
@@ -193,8 +201,7 @@ static off_t sendfile_full(struct sendfile_args *args)
193
201
  off_t all = args->count;
194
202
 
195
203
  while (1) {
196
- rv = (ssize_t)rb_thread_blocking_region(nogvl_sendfile, args,
197
- RUBY_UBF_IO, NULL);
204
+ rv = (ssize_t)WITHOUT_GVL(nogvl_sendfile, args);
198
205
  if (!args->count)
199
206
  break;
200
207
  if (args->eof) {
@@ -222,8 +229,7 @@ static VALUE sendfile_nonblock(struct sendfile_args *args, int try)
222
229
  rb_sys_fail("fcntl");
223
230
  }
224
231
 
225
- rv = (ssize_t)rb_thread_blocking_region(nogvl_sendfile, args,
226
- RUBY_UBF_IO, NULL);
232
+ rv = (ssize_t)WITHOUT_GVL(nogvl_sendfile, args);
227
233
  if (rv < 0) {
228
234
  if (try && errno == EAGAIN)
229
235
  return sym_wait_writable;
@@ -2,7 +2,7 @@
2
2
 
3
3
  spec = Gem::Specification.new do |gs|
4
4
  gs.name = 'sendfile'
5
- gs.version = '1.2.1'
5
+ gs.version = '1.2.2'
6
6
  gs.summary = 'Ruby interface to sendfile(2) system call'
7
7
  gs.description = <<-EOF
8
8
  Allows Ruby programs to access sendfile(2) functionality on
metadata CHANGED
@@ -1,18 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendfile
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
5
- prerelease:
4
+ version: 1.2.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Toby DiPasquale
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-01 00:00:00.000000000 Z
11
+ date: 2014-06-28 00:00:00.000000000 Z
13
12
  dependencies: []
14
- description: ! "Allows Ruby programs to access sendfile(2) functionality on \nany
15
- IO object. Works on Linux, Solaris, FreeBSD and Darwin with\nblocking and non-blocking
13
+ description: "Allows Ruby programs to access sendfile(2) functionality on \nany IO
14
+ object. Works on Linux, Solaris, FreeBSD and Darwin with\nblocking and non-blocking
16
15
  sockets.\n"
17
16
  email: toby@cbcg.net
18
17
  executables: []
@@ -33,27 +32,26 @@ files:
33
32
  - sendfile.gemspec
34
33
  homepage: https://github.com/codeslinger/sendfile
35
34
  licenses: []
35
+ metadata: {}
36
36
  post_install_message:
37
37
  rdoc_options: []
38
38
  require_paths:
39
39
  - lib
40
40
  required_ruby_version: !ruby/object:Gem::Requirement
41
- none: false
42
41
  requirements:
43
- - - ! '>='
42
+ - - '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: 1.8.0
46
45
  required_rubygems_version: !ruby/object:Gem::Requirement
47
- none: false
48
46
  requirements:
49
- - - ! '>='
47
+ - - '>='
50
48
  - !ruby/object:Gem::Version
51
49
  version: '0'
52
50
  requirements: []
53
51
  rubyforge_project: ruby-sendfile
54
- rubygems_version: 1.8.23
52
+ rubygems_version: 2.0.14
55
53
  signing_key:
56
- specification_version: 3
54
+ specification_version: 4
57
55
  summary: Ruby interface to sendfile(2) system call
58
56
  test_files:
59
57
  - test/test_sendfile.rb