BlockingQ

@interface BlockingQ : NSObject {
  pthread_mutex_t lock;
  pthread_cond_t notEmpty;
  Node *first;
  Node *last;
}

A linked-list blocking queue implementation

  • Undocumented

    Declaration

    Objective-C

    @interface BlockingQ : NSObject {
      pthread_mutex_t lock;
      pthread_cond_t notEmpty;
      Node *first;
      Node *last;
    }
  • Undocumented

    Declaration

    Objective-C

    @interface BlockingQ : NSObject {
      pthread_mutex_t lock;
      pthread_cond_t notEmpty;
      Node *first;
      Node *last;
    }
  • Undocumented

    Declaration

    Objective-C

    @interface BlockingQ : NSObject {
      pthread_mutex_t lock;
      pthread_cond_t notEmpty;
      Node *first;
      Node *last;
    }
  • Undocumented

    Declaration

    Objective-C

    @interface BlockingQ : NSObject {
      pthread_mutex_t lock;
      pthread_cond_t notEmpty;
      Node *first;
      Node *last;
    }
  • initialise the blocking queue

    Declaration

    Objective-C

    - (BlockingQ *)init;

    Swift

    init!()

    Return Value

    blocking queue instance

  • A thread-safe operaiton to put a container object of (sub)type Node in the queue. This is called by a producer thread

    Declaration

    Objective-C

    - (void)put:(Node *)obj;

    Swift

    func put(_ obj: Node!)

    Parameters

    obj

    an object which is a subtype of Node

  • A thread-safe operation to remove the first item in the queue - parameter: timeout period in millisec consumer thread waits before returning if queue is empty - returns: an object which is a subtype of Node

    Declaration

    Objective-C

    - (id)take:(uint32_t)timeout;

    Swift

    func take(_ timeout: UInt32) -> Any!

    Parameters

    timeout

    period in millisec consumer thread waits before returning if queue is empty

    Return Value

    an object which is a subtype of Node