Skip to content

Commit

Permalink
Merge pull request #28 from Debosmit-Neogi/master
Browse files Browse the repository at this point in the history
Improved docs
  • Loading branch information
mtrebi authored Oct 13, 2020
2 parents 098828b + 592bf8a commit feb91d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ __Disclaimer: Please Do not use this project in a professional environment. It m

# Build instructions:

This project has been developed using Netbeans and Linux but it should work on Windows, MAC OS and Linux. It can be easily build using CMake and different generators. The following code can be used to generate the VS 2017 project files:
This project has been developed using Netbeans and Linux but it should work on Windows, MAC OS and Linux. It can be easily build using CMake and different other generators. The following code can be used to generate the VS 2017 project files:

```c
// VS 2017
Expand All @@ -34,7 +34,7 @@ cmake .. "Visual Studio 15 2017 Win64"

Then, from VS you can edit and execute the project. Make sure that __main project is set up as the startup project__

If you are using Linux, you need to change the generator (use the default) and execute an extra operations to actually make executable:
If you are using Linux, you need to change the generator (use the default) and execute an extra operation to actually make it executable:

```c
// Linux
Expand All @@ -47,7 +47,7 @@ make

# Thread pool

The way that I understand things better is with images. So, lets take a look at the image of thread pool given by wikipedia:
The way that I understand things better is with images. So, let's take a look at the image of thread pool given by Wikipedia:

<p align="center"> <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Thread_pool.svg/580px-Thread_pool.svg.png"> </p>

Expand All @@ -60,7 +60,7 @@ As you can see, we have three important elements here:

We use a queue to store the work because it's the more sensible data structure. We want the work to be **started** in the same order that we sent it. However, this queue is a little bit **special**. As I said in the previous section, threads are continuously (well, not really, but let's assume that they are) querying the queue to ask for work. When there's work available, threads take the work from the queue and do it. What would happen if two threads try to take the same work at the same time? Well, the program would crash.

To avoid this kind of problems, I implemented a wrapper over the standard C++ Queue that uses mutex to restrict the concurrent access. Let's see a small sample of the SafeQueue class:
To avoid these kinds of problems, I implemented a wrapper over the standard C++ Queue that uses mutex to restrict the concurrent access. Let's see a small sample of the SafeQueue class:

```c
void enqueue(T& t) {
Expand Down

0 comments on commit feb91d6

Please sign in to comment.