Skip to content

Commit

Permalink
added option for threadpool
Browse files Browse the repository at this point in the history
  • Loading branch information
maxilevi committed Dec 28, 2017
1 parent 8f3a68f commit 27ee91e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Assets/Generation/GenerationQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ public class GenerationQueue{
private int _exceptionCount = 0;

public GenerationQueue(World World){
new Thread (Start).Start ();
bool useThreadPool = false;

if (useThreadPool) {
ThreadPool.QueueUserWorkItem ( new WaitCallback( delegate(object state)
{ Start(); }) );
}else{
new Thread (Start).Start ();
}
this._world = World;
}

Expand Down
9 changes: 8 additions & 1 deletion Assets/Generation/MeshQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ public class MeshQueue
private int _exceptionCount = 0;

public MeshQueue(World World){
new Thread (Start).Start ();
bool useThreadPool = false;

if (useThreadPool) {
ThreadPool.QueueUserWorkItem ( new WaitCallback( delegate(object state)
{ Start(); }) );
} else {
new Thread (Start).Start ();
}
this._player = World.Player;
this._world = World;
}
Expand Down

0 comments on commit 27ee91e

Please sign in to comment.