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
cecc790c
Commit
cecc790c
authored
Mar 28, 2012
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #297 from hurtonm/code_cleanup
Code cleanup
parents
8da72710
77d93d70
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
7 additions
and
53 deletions
+7
-53
lb.cpp
src/lb.cpp
+2
-10
mutex.hpp
src/mutex.hpp
+0
-4
own.cpp
src/own.cpp
+0
-18
own.hpp
src/own.hpp
+0
-4
pair.cpp
src/pair.cpp
+1
-7
pipe.cpp
src/pipe.cpp
+2
-2
pipe.hpp
src/pipe.hpp
+1
-1
router.cpp
src/router.cpp
+1
-7
No files found.
src/lb.cpp
View file @
cecc790c
...
...
@@ -131,17 +131,9 @@ bool zmq::lb_t::has_out ()
while
(
active
>
0
)
{
// Check whether zero-sized message can be written to the pipe.
msg_t
msg
;
int
rc
=
msg
.
init
();
errno_assert
(
rc
==
0
);
if
(
pipes
[
current
]
->
check_write
(
&
msg
))
{
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
// Check whether a pipe has room for another message.
if
(
pipes
[
current
]
->
check_write
())
return
true
;
}
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
// Deactivate the pipe.
active
--
;
...
...
src/mutex.hpp
View file @
cecc790c
...
...
@@ -81,28 +81,24 @@ namespace zmq
inline
mutex_t
()
{
int
rc
=
pthread_mutex_init
(
&
mutex
,
NULL
);
if
(
rc
)
posix_assert
(
rc
);
}
inline
~
mutex_t
()
{
int
rc
=
pthread_mutex_destroy
(
&
mutex
);
if
(
rc
)
posix_assert
(
rc
);
}
inline
void
lock
()
{
int
rc
=
pthread_mutex_lock
(
&
mutex
);
if
(
rc
)
posix_assert
(
rc
);
}
inline
void
unlock
()
{
int
rc
=
pthread_mutex_unlock
(
&
mutex
);
if
(
rc
)
posix_assert
(
rc
);
}
...
...
src/own.cpp
View file @
cecc790c
...
...
@@ -80,24 +80,6 @@ void zmq::own_t::launch_child (own_t *object_)
send_own
(
this
,
object_
);
}
void
zmq
::
own_t
::
launch_sibling
(
own_t
*
object_
)
{
// At this point it is important that object is plugged in before its
// owner has a chance to terminate it. Thus, 'plug' command is sent before
// the 'own' command. Given that the mailbox preserves ordering of
// commands, 'term' command from the owner cannot make it to the object
// before the already written 'plug' command.
// Specify the owner of the object.
object_
->
set_owner
(
owner
);
// Plug the object into its I/O thread.
send_plug
(
object_
);
// Make parent own the object.
send_own
(
owner
,
object_
);
}
void
zmq
::
own_t
::
process_term_req
(
own_t
*
object_
)
{
// When shutting down we can ignore termination requests from owned
...
...
src/own.hpp
View file @
cecc790c
...
...
@@ -70,10 +70,6 @@ namespace zmq
// Launch the supplied object and become its owner.
void
launch_child
(
own_t
*
object_
);
// Launch the supplied object and make it your sibling (make your
// owner become its owner as well).
void
launch_sibling
(
own_t
*
object_
);
// Ask owner object to terminate this object. It may take a while
// while actual termination is started. This function should not be
// called more than once.
...
...
src/pair.cpp
View file @
cecc790c
...
...
@@ -108,13 +108,7 @@ bool zmq::pair_t::xhas_out ()
if
(
!
pipe
)
return
false
;
msg_t
msg
;
int
rc
=
msg
.
init
();
errno_assert
(
rc
==
0
);
bool
result
=
pipe
->
check_write
(
&
msg
);
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
return
result
;
return
pipe
->
check_write
();
}
zmq
::
pair_session_t
::
pair_session_t
(
io_thread_t
*
io_thread_
,
bool
connect_
,
...
...
src/pipe.cpp
View file @
cecc790c
...
...
@@ -146,7 +146,7 @@ bool zmq::pipe_t::read (msg_t *msg_)
return
true
;
}
bool
zmq
::
pipe_t
::
check_write
(
msg_t
*
msg_
)
bool
zmq
::
pipe_t
::
check_write
()
{
if
(
unlikely
(
!
out_active
||
state
!=
active
))
return
false
;
...
...
@@ -163,7 +163,7 @@ bool zmq::pipe_t::check_write (msg_t *msg_)
bool
zmq
::
pipe_t
::
write
(
msg_t
*
msg_
)
{
if
(
unlikely
(
!
check_write
(
msg_
)))
if
(
unlikely
(
!
check_write
()))
return
false
;
bool
more
=
msg_
->
flags
()
&
msg_t
::
more
?
true
:
false
;
...
...
src/pipe.hpp
View file @
cecc790c
...
...
@@ -87,7 +87,7 @@ namespace zmq
// Checks whether messages can be written to the pipe. If writing
// the message would cause high watermark the function returns false.
bool
check_write
(
msg_t
*
msg_
);
bool
check_write
();
// Writes a message to the underlying pipe. Returns false if the
// message cannot be written because high watermark was reached.
...
...
src/router.cpp
View file @
cecc790c
...
...
@@ -152,22 +152,16 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_)
if
(
it
!=
outpipes
.
end
())
{
current_out
=
it
->
second
.
pipe
;
msg_t
empty
;
int
rc
=
empty
.
init
();
errno_assert
(
rc
==
0
);
if
(
!
current_out
->
check_write
(
&
empty
))
{
if
(
!
current_out
->
check_write
())
{
it
->
second
.
active
=
false
;
more_out
=
false
;
current_out
=
NULL
;
}
rc
=
empty
.
close
();
errno_assert
(
rc
==
0
);
}
else
if
(
fail_unroutable
)
{
more_out
=
false
;
errno
=
EHOSTUNREACH
;
retval
=
-
1
;
}
}
int
rc
=
msg_
->
close
();
...
...
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