Gjsify LogoGjsify Logo

An opaque data structure which represents an asynchronous queue.

It should only be accessed through the g_async_queue_* functions.

record

Hierarchy

  • AsyncQueue

Index

Constructors

Properties

name: string

Methods

  • length(): number
  • Returns the length of the queue.

    Actually this function returns the number of data items in the queue minus the number of waiting threads, so a negative value means waiting threads, and a positive value means available entries in the queue. A return value of 0 could mean n entries in the queue and n threads waiting. This can happen due to locking of the queue or due to scheduling.

    Returns number

  • lengthUnlocked(): number
  • Returns the length of the queue.

    Actually this function returns the number of data items in the queue minus the number of waiting threads, so a negative value means waiting threads, and a positive value means available entries in the queue. A return value of 0 could mean n entries in the queue and n threads waiting. This can happen due to locking of the queue or due to scheduling.

    This function must be called while holding the queue's lock.

    Returns number

  • lock(): void
  • Acquires the queue's lock. If another thread is already holding the lock, this call will block until the lock becomes available.

    Call g_async_queue_unlock() to drop the lock again.

    While holding the lock, you can only call the g_async_queue_*_unlocked() functions on queue. Otherwise, deadlock may occur.

    Returns void

  • pop(): object
  • Pops data from the queue. If queue is empty, this function blocks until data becomes available.

    Returns object

  • popUnlocked(): object
  • Pops data from the queue. If queue is empty, this function blocks until data becomes available.

    This function must be called while holding the queue's lock.

    Returns object

  • push(data: object): void
  • Pushes the data into the queue. data must not be %NULL.

    Parameters

    • data: object

      data to push into the queue

    Returns void

  • pushFront(item: object): void
  • Pushes the item into the queue. item must not be %NULL. In contrast to g_async_queue_push(), this function pushes the new item ahead of the items already in the queue, so that it will be the next one to be popped off the queue.

    Parameters

    • item: object

      data to push into the queue

    Returns void

  • pushFrontUnlocked(item: object): void
  • Pushes the item into the queue. item must not be %NULL. In contrast to g_async_queue_push_unlocked(), this function pushes the new item ahead of the items already in the queue, so that it will be the next one to be popped off the queue.

    This function must be called while holding the queue's lock.

    Parameters

    • item: object

      data to push into the queue

    Returns void

  • pushUnlocked(data: object): void
  • Pushes the data into the queue. data must not be %NULL.

    This function must be called while holding the queue's lock.

    Parameters

    • data: object

      data to push into the queue

    Returns void

  • refUnlocked(): void
  • Increases the reference count of the asynchronous queue by 1.

    Returns void

  • remove(item: object): boolean
  • Remove an item from the queue.

    Parameters

    • item: object

      the data to remove from the queue

    Returns boolean

  • removeUnlocked(item: object): boolean
  • Remove an item from the queue.

    This function must be called while holding the queue's lock.

    Parameters

    • item: object

      the data to remove from the queue

    Returns boolean

  • Pops data from the queue. If the queue is empty, blocks until end_time or until data becomes available.

    If no data is received before end_time, %NULL is returned.

    To easily calculate end_time, a combination of g_get_real_time() and g_time_val_add() can be used.

    Parameters

    • endTime: TimeVal

      a #GTimeVal, determining the final time

    Returns object

  • timedPopUnlocked(endTime: TimeVal): object
  • Pops data from the queue. If the queue is empty, blocks until end_time or until data becomes available.

    If no data is received before end_time, %NULL is returned.

    To easily calculate end_time, a combination of g_get_real_time() and g_time_val_add() can be used.

    This function must be called while holding the queue's lock.

    Parameters

    • endTime: TimeVal

      a #GTimeVal, determining the final time

    Returns object

  • timeoutPop(timeout: number): object
  • Pops data from the queue. If the queue is empty, blocks for timeout microseconds, or until data becomes available.

    If no data is received before the timeout, %NULL is returned.

    Parameters

    • timeout: number

      the number of microseconds to wait

    Returns object

  • timeoutPopUnlocked(timeout: number): object
  • Pops data from the queue. If the queue is empty, blocks for timeout microseconds, or until data becomes available.

    If no data is received before the timeout, %NULL is returned.

    This function must be called while holding the queue's lock.

    Parameters

    • timeout: number

      the number of microseconds to wait

    Returns object

  • tryPop(): object
  • Tries to pop data from the queue. If no data is available, %NULL is returned.

    Returns object

  • tryPopUnlocked(): object
  • Tries to pop data from the queue. If no data is available, %NULL is returned.

    This function must be called while holding the queue's lock.

    Returns object

  • unlock(): void
  • Releases the queue's lock.

    Calling this function when you have not acquired the with g_async_queue_lock() leads to undefined behaviour.

    Returns void

  • unref(): void
  • Decreases the reference count of the asynchronous queue by 1.

    If the reference count went to 0, the queue will be destroyed and the memory allocated will be freed. So you are not allowed to use the queue afterwards, as it might have disappeared. You do not need to hold the lock to call this function.

    Returns void

  • unrefAndUnlock(): void
  • Decreases the reference count of the asynchronous queue by 1 and releases the lock. This function must be called while holding the queue's lock. If the reference count went to 0, the queue will be destroyed and the memory allocated will be freed.

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method