Skip to content

LightningPORTO/QueueClassExercise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-threaded element queue in C++

This repository has been created to answer an exercise requested by Bosch. The exercise is detailed here.

I consider that the main goal of the exercise has been reached as I have developed:

  • The Queue class with the given interface;
  • A main file to serve as an example implementation;
  • Unit tests using GoogleTest framework;
  • A CMake file to ease the build process.

Folder structure

In this repo you will find the following folder structure:

📦 
├─ include
│  └─ problem_queue.hpp (The core file of the exercise, containing the Queue Class)
├─ src
│  └─  main.cpp (The main file that will implement the test case of the exercise)
├─ tests
│  └─ main_tests.cpp (File to run unit tests using Google Test)
├─ .gitignore
├─ CMakeLists.txt
├─ Offline-Exercise-Queue_v2.pdf
└─ README.md

How to run

  1. Clone this repository and move inside the root folder
  2. Create a build folder and move inside it
$ mkdir build
$ cd build
  1. Configure the CMake
$ cmake ..
  1. Build the project
$ cmake --build .
  1. To run the Unit tests, move inside the build folder and:
$ ctest

Sources

std::queue - Examples

std::unique_lock - Examples

std::condition_variable - Examples

Unit tests (Google Test) - Quick start guide

Known problems

  • The extra : "The reading/writing threads should optionally block for a certain period of time. If the action is successful within this time, true is returned, otherwise false." - Has not been implemented as it would have required changes on the given class interface. However, only slight changes are required to implement this functionality. Preferably using wait_for method from std::condition_variable.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published