Giter Site home page Giter Site logo

objc-zmq's Introduction

objc-zmq: An Objective-C binding to libzmq

This is an Objective-C version of the reference ZeroMQ [object-oriented C API][zmq-docs]. It follows the guidelines laid out by the official ["Guidelines for ZeroMQ bindings"][binding-zmq].

[zmq-docs]: http://api.zeromq.org/zmq.html (zmq(7) Manual Page) [binding-zmq]: http://www.zeromq.org/docs:bindings (Guidelines for ZeroMQ Bindings)

Documentation

Refer to the [ZeroMQ manual pages][zmq-docs]. The Objective-C binding maintains a bit more state than the C API exposes, in that you can query a ZMQContext for its sockets and query a ZMQSocket for its context.

Thread Safety

Early versions of ZeroMQ had some restrictive thread safety and coupling issues:

  • Sockets can only be used from the thread that created them.
  • All ZMQ sockets provided in a single call to zmq_poll() must have been created using the same context.

Because sockets are coupled to contexts for polling, you have to track each socket's context and make sure not to mix them. (The ZMQSocket class tracks this for you.) This is not as restrictive as it sounds, because most applications will only ever use a single context.

Prior to version 2.1.0, each socket was permanently bound to the thread that created it. This made it very difficult to use ZeroMQ sockets with Grand Central Dispatch or NSOperationQueue, because the only persistent thread that these two APIs expose is the thread you're least likely to want to perform socket operations on: the main thread.

Starting with version 2.1.0, a socket can be used from different threads provided a full memory barrier, such as that introduced by <libkern/OSAtomic.h>'s OSMemoryBarrier function, separates the socket's use on one thread from its use on another.

To Do

  • Add functional tests in the form of sample code.
  • Tie polling into the runloop, similar to NSStream, CFSocket, or CFFileDescriptor.

objc-zmq's People

Contributors

ecoffey avatar jeremy-w avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.