---
title: enqueue
framework: kernel
role: pseudoSymbol
path: kernel/iodataqueue/1810927-enqueue
---

# enqueue

Enqueues a new entry on the queue.

## Declaration

```occ
virtual Boolean enqueue(
 void *data,
 UInt32dataSize); 
```

## Parameters

- `data`: Pointer to the data to be added to the queue.
- `dataSize`: Size of the data pointed to by data.

## Return Value

Return Value Returns true on success and false on failure. Typically failure means that the queue is full.

## Overview

Overview This method adds a new data entry of dataSize to the queue. It sets the size parameter of the entry pointed to by the tail value and copies the memory pointed to by the data parameter in place in the queue. Once that is done, it moves the tail to the next available location. When attempting to add a new entry towards the end of the queue and there isn't enough space at the end, it wraps back to the beginning. If the queue is empty when a new entry is added, sendDataAvailableNotification() is called to send a message to the user process that data is now available.

## See Also

### Miscellaneous

- [getMemoryDescriptor](kernel/iodataqueue/1810939-getmemorydescriptor.md)
- [initWithCapacity](kernel/iodataqueue/1810950-initwithcapacity.md)
- [initWithEntries](kernel/iodataqueue/1810963-initwithentries.md)
- [sendDataAvailableNotification](kernel/iodataqueue/1810980-senddataavailablenotification.md)
- [setNotificationPort](kernel/iodataqueue/1810994-setnotificationport.md)
- [withCapacity](kernel/iodataqueue/1811001-withcapacity.md)
- [withEntries](kernel/iodataqueue/1811020-withentries.md)
