178 of 286
164 PeekQueue Type Subroutine Invocation PeekQueue(queue, var, count) Parameter Method Type Description queue ByRef array of Byte The queue from which to retrieve data. var ByRef any type The variable to receive the retrieved data. count ByVal int16 The number of bytes to retrieve. Discussion This routine will copy the specified number of bytes from the queue to the indicated variable but it does not remove them from the queue. The routine will not return until it can copy the entire number of bytes specified. Because of this, you should usually check the number of bytes available in the queue using GetQueueCount() before calling PeekQueue(). Note that if the calling task is locked and the queue contains insufficient data when this routine is called, the task will be unlocked to allow other tasks to run. Caution If the requested number of bytes is larger than the queue capacity, the routine will never return. Likewise, if not enough data is placed in the queue, the routine will never return. Also, if the variable to receive the data is smaller than the number of bytes indicated, adjacent memory will be overwritten, usually with undesirable results. Example Compatibility BasicX allows any type for the first parameter. This implementation requires that it be an array of Byte.