Skip to content

Commit

Permalink
ZMQSocket: -close: Fix crash when called twice. (NOT THREADSAFE)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-w committed Jan 9, 2011
1 parent 0e01e0b commit db51b6b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/ZMQSocket.m
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ - (id)initWithContext:(ZMQContext *)context_ type:(ZMQSocketType)type_ {
@synthesize socket; @synthesize socket;
@synthesize closed; @synthesize closed;
- (void)close { - (void)close {
int err = zmq_close(self.socket); // FIXME: This is not thread-safe.
if (err) { if (!self.closed) {
ZMQLogError(self, @"zmq_close"); int err = zmq_close(self.socket);
return; if (err) {
ZMQLogError(self, @"zmq_close");
return;
}
self.closed = YES;
} }
self.closed = YES;
} }


- (void)dealloc { - (void)dealloc {
Expand Down

0 comments on commit db51b6b

Please sign in to comment.