Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
33cb20a7
Commit
33cb20a7
authored
Feb 16, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZMQII-77: Put librbzmq symbols into ZMQ module
parent
1e787848
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
45 deletions
+49
-45
AUTHORS
AUTHORS
+1
-0
rbzmq.cpp
bindings/ruby/rbzmq.cpp
+39
-36
local_lat.rb
perf/ruby/local_lat.rb
+2
-2
local_thr.rb
perf/ruby/local_thr.rb
+3
-3
remote_lat.rb
perf/ruby/remote_lat.rb
+2
-2
remote_thr.rb
perf/ruby/remote_thr.rb
+2
-2
No files found.
AUTHORS
View file @
33cb20a7
...
...
@@ -4,6 +4,7 @@ Contributors
Alexej Lotz
Asko Kauppi
Barak Amar
Chris Wong
Conrad D. Steenberg
Dhruva Krishnamurthy
Dirk O. Kaar
...
...
bindings/ruby/rbzmq.cpp
View file @
33cb20a7
...
...
@@ -69,8 +69,8 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_)
{
assert
(
!
DATA_PTR
(
self_
));
if
(
strcmp
(
rb_obj_classname
(
context_
),
"Context"
)
!=
0
)
{
rb_raise
(
rb_eArgError
,
"expected Context object"
);
if
(
strcmp
(
rb_obj_classname
(
context_
),
"
ZMQ::
Context"
)
!=
0
)
{
rb_raise
(
rb_eArgError
,
"expected
ZMQ::
Context object"
);
return
Qnil
;
}
...
...
@@ -103,7 +103,7 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
long
optval
=
FIX2LONG
(
optval_
);
// Forward the code to native 0MQ library.
rc
=
zmq_setsockopt
(
DATA_PTR
(
self_
),
NUM2INT
(
option_
),
rc
=
zmq_setsockopt
(
DATA_PTR
(
self_
),
NUM2INT
(
option_
),
(
void
*
)
&
optval
,
4
);
}
break
;
...
...
@@ -113,8 +113,8 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_,
case
ZMQ_UNSUBSCRIBE
:
// Forward the code to native 0MQ library.
rc
=
zmq_setsockopt
(
DATA_PTR
(
self_
),
NUM2INT
(
option_
),
(
void
*
)
StringValueCStr
(
optval_
),
RSTRING_LEN
(
optval_
));
rc
=
zmq_setsockopt
(
DATA_PTR
(
self_
),
NUM2INT
(
option_
),
(
void
*
)
StringValueCStr
(
optval_
),
RSTRING_LEN
(
optval_
));
break
;
default:
...
...
@@ -170,7 +170,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_)
return
Qnil
;
}
memcpy
(
zmq_msg_data
(
&
msg
),
RSTRING_PTR
(
msg_
),
RSTRING_LEN
(
msg_
));
rc
=
zmq_send
(
DATA_PTR
(
self_
),
&
msg
,
NUM2INT
(
flags_
));
if
(
rc
!=
0
&&
errno
==
EAGAIN
)
{
rc
=
zmq_msg_close
(
&
msg
);
...
...
@@ -233,13 +233,16 @@ static VALUE socket_recv (VALUE self_, VALUE flags_)
}
extern
"C"
void
Init_librbzmq
()
{
VALUE
context_type
=
rb_define_class
(
"Context"
,
rb_cObject
);
{
VALUE
zmq_module
=
rb_define_module
(
"ZMQ"
);
VALUE
context_type
=
rb_define_class_under
(
zmq_module
,
"Context"
,
rb_cObject
);
rb_define_alloc_func
(
context_type
,
context_alloc
);
rb_define_method
(
context_type
,
"initialize"
,
(
VALUE
(
*
)(...))
context_initialize
,
3
);
VALUE
socket_type
=
rb_define_class
(
"Socket"
,
rb_cObject
);
VALUE
socket_type
=
rb_define_class_under
(
zmq_module
,
"Socket"
,
rb_cObject
);
rb_define_alloc_func
(
socket_type
,
socket_alloc
);
rb_define_method
(
socket_type
,
"initialize"
,
(
VALUE
(
*
)(...))
socket_initialize
,
2
);
...
...
@@ -256,31 +259,31 @@ extern "C" void Init_librbzmq ()
rb_define_method
(
socket_type
,
"recv"
,
(
VALUE
(
*
)(...))
socket_recv
,
1
);
rb_define_
global_const
(
"HWM"
,
INT2NUM
(
ZMQ_HWM
));
rb_define_
global_const
(
"LWM"
,
INT2NUM
(
ZMQ_LWM
));
rb_define_
global_const
(
"SWAP"
,
INT2NUM
(
ZMQ_SWAP
));
rb_define_
global_const
(
"AFFINITY"
,
INT2NUM
(
ZMQ_AFFINITY
));
rb_define_
global_const
(
"IDENTITY"
,
INT2NUM
(
ZMQ_IDENTITY
));
rb_define_
global_const
(
"SUBSCRIBE"
,
INT2NUM
(
ZMQ_SUBSCRIBE
));
rb_define_
global_const
(
"UNSUBSCRIBE"
,
INT2NUM
(
ZMQ_UNSUBSCRIBE
));
rb_define_
global_const
(
"RATE"
,
INT2NUM
(
ZMQ_RATE
));
rb_define_
global_const
(
"RECOVERY_IVL"
,
INT2NUM
(
ZMQ_RECOVERY_IVL
));
rb_define_
global_const
(
"MCAST_LOOP"
,
INT2NUM
(
ZMQ_MCAST_LOOP
));
rb_define_
global_const
(
"SNDBUF"
,
INT2NUM
(
ZMQ_SNDBUF
));
rb_define_
global_const
(
"RCVBUF"
,
INT2NUM
(
ZMQ_RCVBUF
));
rb_define_
global_const
(
"NOBLOCK"
,
INT2NUM
(
ZMQ_NOBLOCK
));
rb_define_
global_const
(
"NOFLUSH"
,
INT2NUM
(
ZMQ_NOFLUSH
));
rb_define_
global_const
(
"P2P"
,
INT2NUM
(
ZMQ_P2P
));
rb_define_
global_const
(
"SUB"
,
INT2NUM
(
ZMQ_SUB
));
rb_define_
global_const
(
"PUB"
,
INT2NUM
(
ZMQ_PUB
));
rb_define_
global_const
(
"REQ"
,
INT2NUM
(
ZMQ_REQ
));
rb_define_
global_const
(
"REP"
,
INT2NUM
(
ZMQ_REP
));
rb_define_
global_const
(
"XREQ"
,
INT2NUM
(
ZMQ_XREQ
));
rb_define_
global_const
(
"XREP"
,
INT2NUM
(
ZMQ_XREP
));
rb_define_
global_const
(
"UPSTREAM"
,
INT2NUM
(
ZMQ_UPSTREAM
));
rb_define_
global_const
(
"DOWNSTREAM"
,
INT2NUM
(
ZMQ_DOWNSTREAM
));
rb_define_
global_const
(
"POLL"
,
INT2NUM
(
ZMQ_POLL
));
rb_define_
const
(
zmq_module
,
"HWM"
,
INT2NUM
(
ZMQ_HWM
));
rb_define_
const
(
zmq_module
,
"LWM"
,
INT2NUM
(
ZMQ_LWM
));
rb_define_
const
(
zmq_module
,
"SWAP"
,
INT2NUM
(
ZMQ_SWAP
));
rb_define_
const
(
zmq_module
,
"AFFINITY"
,
INT2NUM
(
ZMQ_AFFINITY
));
rb_define_
const
(
zmq_module
,
"IDENTITY"
,
INT2NUM
(
ZMQ_IDENTITY
));
rb_define_
const
(
zmq_module
,
"SUBSCRIBE"
,
INT2NUM
(
ZMQ_SUBSCRIBE
));
rb_define_
const
(
zmq_module
,
"UNSUBSCRIBE"
,
INT2NUM
(
ZMQ_UNSUBSCRIBE
));
rb_define_
const
(
zmq_module
,
"RATE"
,
INT2NUM
(
ZMQ_RATE
));
rb_define_
const
(
zmq_module
,
"RECOVERY_IVL"
,
INT2NUM
(
ZMQ_RECOVERY_IVL
));
rb_define_
const
(
zmq_module
,
"MCAST_LOOP"
,
INT2NUM
(
ZMQ_MCAST_LOOP
));
rb_define_
const
(
zmq_module
,
"SNDBUF"
,
INT2NUM
(
ZMQ_SNDBUF
));
rb_define_
const
(
zmq_module
,
"RCVBUF"
,
INT2NUM
(
ZMQ_RCVBUF
));
rb_define_
const
(
zmq_module
,
"NOBLOCK"
,
INT2NUM
(
ZMQ_NOBLOCK
));
rb_define_
const
(
zmq_module
,
"NOFLUSH"
,
INT2NUM
(
ZMQ_NOFLUSH
));
rb_define_
const
(
zmq_module
,
"P2P"
,
INT2NUM
(
ZMQ_P2P
));
rb_define_
const
(
zmq_module
,
"SUB"
,
INT2NUM
(
ZMQ_SUB
));
rb_define_
const
(
zmq_module
,
"PUB"
,
INT2NUM
(
ZMQ_PUB
));
rb_define_
const
(
zmq_module
,
"REQ"
,
INT2NUM
(
ZMQ_REQ
));
rb_define_
const
(
zmq_module
,
"REP"
,
INT2NUM
(
ZMQ_REP
));
rb_define_
const
(
zmq_module
,
"XREQ"
,
INT2NUM
(
ZMQ_XREQ
));
rb_define_
const
(
zmq_module
,
"XREP"
,
INT2NUM
(
ZMQ_XREP
));
rb_define_
const
(
zmq_module
,
"UPSTREAM"
,
INT2NUM
(
ZMQ_UPSTREAM
));
rb_define_
const
(
zmq_module
,
"DOWNSTREAM"
,
INT2NUM
(
ZMQ_DOWNSTREAM
));
rb_define_
const
(
zmq_module
,
"POLL"
,
INT2NUM
(
ZMQ_POLL
));
}
perf/ruby/local_lat.rb
View file @
33cb20a7
...
...
@@ -27,8 +27,8 @@ bind_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
REP
);
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
REP
);
s
.
bind
(
bind_to
);
for
i
in
0
...
roundtrip_count
do
...
...
perf/ruby/local_thr.rb
View file @
33cb20a7
...
...
@@ -27,9 +27,9 @@ bind_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
SUB
);
s
.
setsockopt
(
SUBSCRIBE
,
""
);
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
SUB
);
s
.
setsockopt
(
ZMQ
::
SUBSCRIBE
,
""
);
# Add your socket options here.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
...
...
perf/ruby/remote_lat.rb
View file @
33cb20a7
...
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
roundtrip_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
REQ
);
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
REQ
);
s
.
connect
(
connect_to
);
msg
=
"
#{
'0'
*
message_size
}
"
...
...
perf/ruby/remote_thr.rb
View file @
33cb20a7
...
...
@@ -27,8 +27,8 @@ connect_to = ARGV[0]
message_size
=
ARGV
[
1
].
to_i
message_count
=
ARGV
[
2
].
to_i
ctx
=
Context
.
new
(
1
,
1
,
0
)
s
=
Socket
.
new
(
ctx
,
PUB
);
ctx
=
ZMQ
::
Context
.
new
(
1
,
1
,
0
)
s
=
ZMQ
::
Socket
.
new
(
ctx
,
ZMQ
::
PUB
);
# Add your socket options here.
# For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment