Changes

Jump to: navigation, search

Team Darth Vector

559 bytes added, 17:30, 4 December 2017
Added Lovely Code example.
Code example or Picture here ^_^
<pre>
#include <iostream>
#include <thread>
#include <mutex>
 
//Some threads are spawned which call this function
//Declared the following within the class std::mutex NightsWatch;
void GameOfThronesClass::GuardTheWall(){
 
//Protect until Unlock() is called. Only 1 thread may do this below at a time
NightsWatch.Lock();
 
//Increment
DaysWithoutWhiteWalkerAttack++;
std::cout << "It has been " << DaysWithoutWhiteWalkerAttack << " since the last attack at Castle Black!\n";
 
//Allow Next thread to execute the above iteration
NightsWatch.Unlock();
 
 
}
</pre>
===Parallelism Problems in STL===
129
edits

Navigation menu