PathEngine home previous: 'memory'next: 'threadpool'
Contents, Programmers Guide, Example Projects, 'backgroundloading'

'backgroundloading'

Description

A modified version of 'pathstress', with mesh loading, random base obstacle placement and preprocess generation performed in a background thread whilst pathfinding queries are running in a foreground worker thread.

The release build of this project can be run by double-clicking 'run backgroundloading.bat', in the 'bin' subdirectory of the SDK.
A prebuilt release dll for this project is included with the SDK archive.

In this example, the main thread of execution is used as a background thread.
This background thread iterates over a fixed size queue, loading meshes, generating preprocess and then pushing the meshes onto the queue once preprocess generation is complete.
A foreground thread pops meshes from the queue and runs a set of operations involving setting up random collision contexts and then running random pathfinding queries.

Tallies are displayed for the number of meshes queued and the number dispatched.

The CRITICAL_SECTION multithreading primitive is used in the example as well as CreateThread() and wait calls from the windows multithreading API, so the code is specific to windows platforms.
Porting the example functionality to other platforms should be pretty straightforward, however.

Note that because a thread other than the main thread is used to update the testbed, the testbed window can become unresponsive during execution.
This doesnt effect the functionality of the demo or the rendering of the mesh and paths queried.


Documentation for PathEngine release 5.24 - Copyright © 2002-2010 PathEnginenext: 'threadpool'