zmq 2.0.7 → 2.0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/Makefile +17 -17
  2. data/rbzmq.c +71 -41
  3. metadata +4 -3
data/Makefile CHANGED
@@ -4,18 +4,18 @@ SHELL = /bin/sh
4
4
  #### Start of system configuration section. ####
5
5
 
6
6
  srcdir = .
7
- topdir = /opt/local/include/ruby1.9-1.9.1
8
- hdrdir = /opt/local/include/ruby1.9-1.9.1
9
- arch_hdrdir = /opt/local/include/ruby1.9-1.9.1/$(arch)
7
+ topdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1
8
+ hdrdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1
9
+ arch_hdrdir = /usr/local/Cellar/ruby/1.9.1-p378/include/ruby-1.9.1/$(arch)
10
10
  VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
11
- prefix = $(DESTDIR)/opt/local
11
+ prefix = $(DESTDIR)/usr/local/Cellar/ruby/1.9.1-p378
12
12
  exec_prefix = $(prefix)
13
13
  vendorhdrdir = $(rubyhdrdir)/vendor_ruby
14
14
  sitehdrdir = $(rubyhdrdir)/site_ruby
15
15
  rubyhdrdir = $(includedir)/$(RUBY_INSTALL_NAME)-$(ruby_version)
16
16
  vendordir = $(libdir)/$(RUBY_INSTALL_NAME)/vendor_ruby
17
- sitedir = $(libdir)/$(RUBY_INSTALL_NAME)/site_ruby
18
- mandir = $(DESTDIR)/opt/local/share/man
17
+ sitedir = $(DESTDIR)/Library/Ruby/Site
18
+ mandir = $(datarootdir)/man
19
19
  localedir = $(datarootdir)/locale
20
20
  libdir = $(exec_prefix)/lib
21
21
  psdir = $(docdir)
@@ -41,8 +41,8 @@ sitearchdir = $(sitelibdir)/$(sitearch)
41
41
  vendorlibdir = $(vendordir)/$(ruby_version)
42
42
  vendorarchdir = $(vendorlibdir)/$(sitearch)
43
43
 
44
- CC = /usr/bin/gcc-4.2
45
- CXX = /usr/bin/g++-4.2
44
+ CC = /usr/bin/cc
45
+ CXX = /usr/bin/c++
46
46
  LIBRUBY = $(LIBRUBY_SO)
47
47
  LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
48
48
  LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
@@ -55,12 +55,12 @@ cflags = $(optflags) $(debugflags) $(warnflags)
55
55
  optflags = -O2
56
56
  debugflags = -g
57
57
  warnflags = -Wall -Wno-parentheses
58
- CFLAGS = -fno-common -O2 -arch x86_64 $(cflags) -fno-common -pipe -fno-common
58
+ CFLAGS = -fno-common -O3 -march=core2 -msse4.1 -w -pipe $(cflags) -fno-common -pipe -fno-common
59
59
  INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
60
60
  DEFS =
61
- CPPFLAGS = -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
62
- CXXFLAGS = $(CFLAGS) -O2 -arch x86_64 $(cxxflags)
63
- ldflags = -L. -L/opt/local/lib -L/usr/local/lib
61
+ CPPFLAGS = -I/usr/local/Cellar/readline/6.0/include -I/usr/local/Cellar/readline/6.0/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags)
62
+ CXXFLAGS = $(CFLAGS) -O3 -march=core2 -msse4.1 -w -pipe $(cxxflags)
63
+ ldflags = -L. -L/usr/local/Cellar/readline/6.0/lib -L/usr/local/Cellar/readline/6.0/lib
64
64
  dldflags =
65
65
  archflag =
66
66
  DLDFLAGS = $(ldflags) $(dldflags) $(archflag)
@@ -69,12 +69,12 @@ LDSHAREDXX = $(LDSHARED)
69
69
  AR = ar
70
70
  EXEEXT =
71
71
 
72
- RUBY_INSTALL_NAME = ruby1.9
73
- RUBY_SO_NAME = ruby1.9
74
- arch = i386-darwin10
75
- sitearch = i386-darwin10
72
+ RUBY_INSTALL_NAME = ruby
73
+ RUBY_SO_NAME = ruby
74
+ arch = i386-darwin10.3.0
75
+ sitearch = i386-darwin10.3.0
76
76
  ruby_version = 1.9.1
77
- ruby = /opt/local/bin/ruby1.9
77
+ ruby = /usr/local/Cellar/ruby/1.9.1-p378/bin/ruby
78
78
  RUBY = $(ruby)
79
79
  RM = rm -f
80
80
  RM_RF = $(RUBY) -run -e rm -- -rf
data/rbzmq.c CHANGED
@@ -268,72 +268,57 @@ static VALUE zmq_poll_blocking (void* args_)
268
268
 
269
269
  #endif
270
270
 
271
- /*
272
- * call-seq:
273
- * ZMQ.select(in, out=[], err=[], timeout=nil) -> [in, out, err] | nil
274
- *
275
- * Like IO.select, but also works with 0MQ sockets.
276
- */
277
- static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
271
+ struct select_arg {
272
+ VALUE readset;
273
+ VALUE writeset;
274
+ VALUE errset;
275
+ long timeout_usec;
276
+ zmq_pollitem_t *items;
277
+ };
278
+
279
+ static VALUE internal_select(VALUE argval)
278
280
  {
279
- VALUE readset, writeset, errset, timeout;
280
- rb_scan_args (argc_, argv_, "13", &readset, &writeset, &errset, &timeout);
281
+ struct select_arg *arg = (struct select_arg *)argval;
281
282
 
282
- long timeout_usec;
283
283
  int rc, nitems, i;
284
- zmq_pollitem_t *items, *item;
285
-
286
- if (!NIL_P (readset)) Check_Type (readset, T_ARRAY);
287
- if (!NIL_P (writeset)) Check_Type (writeset, T_ARRAY);
288
- if (!NIL_P (errset)) Check_Type (errset, T_ARRAY);
289
-
290
- if (NIL_P (timeout))
291
- timeout_usec = -1;
292
- else
293
- timeout_usec = (long)(NUM2DBL (timeout) * 1000000);
294
-
295
- /* Conservative estimate for nitems before we traverse the lists. */
296
- nitems = (NIL_P (readset) ? 0 : RARRAY_LEN (readset)) +
297
- (NIL_P (writeset) ? 0 : RARRAY_LEN (writeset)) +
298
- (NIL_P (errset) ? 0 : RARRAY_LEN (errset));
299
- items = (zmq_pollitem_t*)ruby_xmalloc(sizeof(zmq_pollitem_t) * nitems);
284
+ zmq_pollitem_t *item;
300
285
 
301
286
  struct poll_state ps;
302
287
  ps.nitems = 0;
303
- ps.items = items;
288
+ ps.items = arg->items;
304
289
  ps.io_objects = rb_ary_new ();
305
290
 
306
- if (!NIL_P (readset)) {
291
+ if (!NIL_P (arg->readset)) {
307
292
  ps.event = ZMQ_POLLIN;
308
- rb_iterate(rb_each, readset, (iterfunc)poll_add_item, (VALUE)&ps);
293
+ rb_iterate(rb_each, arg->readset, (iterfunc)poll_add_item, (VALUE)&ps);
309
294
  }
310
295
 
311
- if (!NIL_P (writeset)) {
296
+ if (!NIL_P (arg->writeset)) {
312
297
  ps.event = ZMQ_POLLOUT;
313
- rb_iterate(rb_each, writeset, (iterfunc)poll_add_item, (VALUE)&ps);
298
+ rb_iterate(rb_each, arg->writeset, (iterfunc)poll_add_item, (VALUE)&ps);
314
299
  }
315
300
 
316
- if (!NIL_P (errset)) {
301
+ if (!NIL_P (arg->errset)) {
317
302
  ps.event = ZMQ_POLLERR;
318
- rb_iterate(rb_each, errset, (iterfunc)poll_add_item, (VALUE)&ps);
303
+ rb_iterate(rb_each, arg->errset, (iterfunc)poll_add_item, (VALUE)&ps);
319
304
  }
320
305
 
321
306
  /* Reset nitems to the actual number of zmq_pollitem_t records we're sending. */
322
307
  nitems = ps.nitems;
323
308
 
324
309
  #ifdef HAVE_RUBY_INTERN_H
325
- if (timeout_usec != 0) {
310
+ if (arg->timeout_usec != 0) {
326
311
  struct zmq_poll_args poll_args;
327
- poll_args.items = items;
328
- poll_args.nitems = nitems;
329
- poll_args.timeout_usec = timeout_usec;
312
+ poll_args.items = ps.items;
313
+ poll_args.nitems = ps.nitems;
314
+ poll_args.timeout_usec = arg->timeout_usec;
330
315
 
331
316
  rb_thread_blocking_region (zmq_poll_blocking, (void*)&poll_args, NULL, NULL);
332
317
  rc = poll_args.rc;
333
318
  }
334
319
  else
335
320
  #endif
336
- rc = zmq_poll (items, nitems, timeout_usec);
321
+ rc = zmq_poll (ps.items, ps.nitems, arg->timeout_usec);
337
322
 
338
323
  if (rc == -1) {
339
324
  rb_raise(rb_eRuntimeError, "%s", zmq_strerror (zmq_errno ()));
@@ -346,7 +331,7 @@ static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
346
331
  VALUE write_active = rb_ary_new ();
347
332
  VALUE err_active = rb_ary_new ();
348
333
 
349
- for (i = 0, item = &items[0]; i < nitems; i++, item++) {
334
+ for (i = 0, item = &ps.items[0]; i < nitems; i++, item++) {
350
335
  if (item->revents != 0) {
351
336
  VALUE io = RARRAY_PTR (ps.io_objects)[i];
352
337
 
@@ -359,11 +344,56 @@ static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
359
344
  }
360
345
  }
361
346
 
362
- ruby_xfree (items);
363
-
364
347
  return rb_ary_new3 (3, read_active, write_active, err_active);
365
348
  }
366
349
 
350
+ static VALUE module_select_internal(VALUE readset, VALUE writeset, VALUE errset, long timeout_usec)
351
+ {
352
+ int nitems;
353
+ struct select_arg arg;
354
+
355
+ /* Conservative estimate for nitems before we traverse the lists. */
356
+ nitems = (NIL_P (readset) ? 0 : RARRAY_LEN (readset)) +
357
+ (NIL_P (writeset) ? 0 : RARRAY_LEN (writeset)) +
358
+ (NIL_P (errset) ? 0 : RARRAY_LEN (errset));
359
+ arg.items = (zmq_pollitem_t*)ruby_xmalloc(sizeof(zmq_pollitem_t) * nitems);
360
+
361
+ arg.readset = readset;
362
+ arg.writeset = writeset;
363
+ arg.errset = errset;
364
+ arg.timeout_usec = timeout_usec;
365
+
366
+ #ifdef HAVE_RUBY_INTERN_H
367
+ return rb_ensure(internal_select, (VALUE)&arg, (void (*)())ruby_xfree, (VALUE)arg.items);
368
+ #else
369
+ return rb_ensure(internal_select, (VALUE)&arg, (VALUE (*)())ruby_xfree, (VALUE)arg.items);
370
+ #endif
371
+ }
372
+
373
+ /*
374
+ * call-seq:
375
+ * ZMQ.select(in, out=[], err=[], timeout=nil) -> [in, out, err] | nil
376
+ *
377
+ * Like IO.select, but also works with 0MQ sockets.
378
+ */
379
+ static VALUE module_select (int argc_, VALUE* argv_, VALUE self_)
380
+ {
381
+ VALUE readset, writeset, errset, timeout;
382
+ rb_scan_args (argc_, argv_, "13", &readset, &writeset, &errset, &timeout);
383
+
384
+ long timeout_usec;
385
+
386
+ if (!NIL_P (readset)) Check_Type (readset, T_ARRAY);
387
+ if (!NIL_P (writeset)) Check_Type (writeset, T_ARRAY);
388
+ if (!NIL_P (errset)) Check_Type (errset, T_ARRAY);
389
+
390
+ if (NIL_P (timeout))
391
+ timeout_usec = -1;
392
+ else
393
+ timeout_usec = (long)(NUM2DBL (timeout) * 1000000);
394
+
395
+ return module_select_internal(readset, writeset, errset, timeout_usec);
396
+ }
367
397
 
368
398
  static void socket_free (void *s)
369
399
  {
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zmq
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 113
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
9
  - 7
10
- version: 2.0.7
10
+ - 1
11
+ version: 2.0.7.1
11
12
  platform: ruby
12
13
  authors:
13
14
  - Martin Sustrik
@@ -16,7 +17,7 @@ autorequire:
16
17
  bindir: bin
17
18
  cert_chain: []
18
19
 
19
- date: 2010-06-28 00:00:00 -07:00
20
+ date: 2010-08-17 00:00:00 -07:00
20
21
  default_executable:
21
22
  dependencies: []
22
23