From b38a2c76c6dfaaa7a0e8abe90a197c151b37dc6b Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Wed, 19 Apr 2023 01:40:22 +0200 Subject: [PATCH] Fixing typo. --- README.md | 2 +- include/philosopher.hpp | 14 +++++++------- src/main.cpp | 2 +- src/philosopher.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 71418a3..ce8a08b 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A commented example of solving the dining philosophers multithreading problem. The dinner philosophers problem consists of a round table where N number of philosophers are seated, every philosopher has a fork -on each side that they are supposed to share with their neighbours +on each side that they are supposed to share with their neighbors to eat a spaghetti that can only eated by the usage of two forks. diff --git a/include/philosopher.hpp b/include/philosopher.hpp index 27608d6..4e112dd 100644 --- a/include/philosopher.hpp +++ b/include/philosopher.hpp @@ -22,7 +22,7 @@ extern std::mutex printing; * * Philosophers are seated in a round table. * In order of being able to eat a philosopher should be able to take - * the two forks on his sides so no other of its neighbour philosophers + * the two forks on his sides so no other of its neighbor philosophers * should be eating at this time. */ class Philosopher { @@ -40,19 +40,19 @@ private: void setState(PhilosopherState state); - //! Method to guess the numberOfPhilosopher of the left neighbour of this philosopher. + //! Method to guess the numberOfPhilosopher of the left neighbor of this philosopher. size_t leftPhilosopherNumber(void); - //! Method to guess the numberOfPhilosopher of the right neighbour of this philosopher. + //! Method to guess the numberOfPhilosopher of the right neighbor of this philosopher. size_t rightPhilosopherNumber(void); - //! Retrieve the left neighbour. + //! Retrieve the left neighbor. PhilosopherPtr leftPhilosopher(void); - //! Retrieve the right neighbour. + //! Retrieve the right neighbor. PhilosopherPtr rightPhilosopher(void); @@ -60,7 +60,7 @@ private: void think(void); - //! The philosopher waits until the forks of his neighbours are free and then takes the two forks. + //! The philosopher waits until the forks of his neighbors are free and then takes the two forks. void takeForks(void); @@ -69,7 +69,7 @@ private: void eat(void); - //! The philosopher puts the forks in the table to be used by his neighbours. + //! The philosopher puts the forks in the table to be used by his neighbors. void putForks(void); diff --git a/src/main.cpp b/src/main.cpp index 0d41f22..d6bd1c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ main(int argc, char **argv) { threads.push_back(std::jthread([philosophers, numberOfPhilosopher] { // This starts the dinner for the philosopher *numberOfPhilosopher. // While philosophers are yet not dinning the state for them is thinking - // anyway, so they have to problem with the neighbours dining already. + // anyway, so they have to problem with the neighbors dining already. (*philosophers)[*numberOfPhilosopher]->startThread(); } )); } diff --git a/src/philosopher.cpp b/src/philosopher.cpp index 76d5760..fafa5e7 100644 --- a/src/philosopher.cpp +++ b/src/philosopher.cpp @@ -80,7 +80,7 @@ void Philosopher::putForks() { std::lock_guard lk{changingForkState}; // Set the philosopher in thinking state. setState(PhilosopherState::THINKING); - // Attempts to free the lock of neighbours if they are locked because of this philosopher. + // Attempts to free the lock of neighbors if they are locked because of this philosopher. leftPhilosopher()->test(); rightPhilosopher()->test(); } @@ -109,7 +109,7 @@ Philosopher::startThread() { takeForks(); // When the two forks are available the philosopher eats. eat(); - // Then the philosopher puts the two forks on the table to be used by the philosopher's neighbours. + // Then the philosopher puts the two forks on the table to be used by the philosopher's neighbors. putForks(); } }