Figure 1: Defines three classes for representing Promise resolved, rejected, and pending state. Those classes are Resolved State, Rejected State, and Pending State
FIGURE 2
Figure 2: Shows the design for a settlement object which resolves or rejects a Promise
FIGURE 3
Figure 3: Illustrates the change in cyclomatic complexity across Promise designs
FIGURE 4
Figure 4: Shows run-times for each library
Listing 1
Listing 1: A simple example illustrating the structure and behavior of Promise code in JavaScript
Listing 2
Listing 2: The Promise-cpp version of the JavaScript code sample where two separate Defers are created. The first starts a then() chain and the second begins another using the same resolved value
Listing 3
Listing 3: The PoolQueue version of the JavaScript code sample where two then () chains are began using the same Promise. Note the call to settle a Promise at the bottom
Listing 4
Listing 4: The STL version of the JavaScript code sample where Promises are managed using a combition of STL futures Promises and threads
Listing 5
Listing 5: The HPX version of the JavaScript code sample where Futures are used instead of Promises
Listing 6
Listing 6: The STLab version of the JavaScript code sample where Futures are used instead of Promises
Listing 7
Listing 7: The Promise++ version of the JavaScript code sample
Listing 8
Listing 8: Handle many Promises in a C++ Map and reference the results with the same keys
Figures at a glance