Home > Data Structures & Algorithms, Libraries & Frameworks, Projects > Arduino: A library for implementing a generic, dynamic queue (array version).

Arduino: A library for implementing a generic, dynamic queue (array version).

September 29, 2010 Leave a comment Go to comments

This project refers to an Arduino library implementing a generic, dynamic queue (array version).

The data structure is implemented as a class in C++.

For more information, you can get the project itself ‘QueueArray‘.

  1. April 10, 2014 at 18:46

    It seems that the queue you are using in your Arduino application is a common in-memory resource. Since multiple code segments use it either for calling enqueue or dequeue. This behavior can lead to a race condition since the interrupt service routines are executed asynchronously. You could use a locking mechanism to protect the shared resource either by introducing in your code semaphores or mutexes.

    A variable should be declared volatile whenever its value can be changed by something beyond the control of the code section in which it appears, such as a concurrently executing thread. In the Arduino, the only place that this is likely to occur is in sections of code associated with interrupts, called an interrupt service routine.

    By playing with the library you can find the best place to add it.

  2. Pieter Lauwers
    April 8, 2014 at 22:40

    Thanks Efstathios for this nice library.

    Is it possible to use your library in combination with interrupts?

    I would like to enqueue the micros() value when an interrupt occurs and then process the values later in the main code.

    I wonder if any variable should be declared as volatile or if I should disable interrupts when I’m dequeuing a value.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: