Fixing typo.

This commit is contained in:
Sergiotarxz 2023-04-19 01:40:22 +02:00
parent e578422eab
commit b38a2c76c6
4 changed files with 11 additions and 11 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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();
} ));
}

View File

@ -80,7 +80,7 @@ void Philosopher::putForks() {
std::lock_guard<std::mutex> 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();
}
}