Skip to content

Commit

Permalink
Thread demo clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthayhurst committed Feb 5, 2024
1 parent 45024db commit 31e8de1
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/threadDemo.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
#include <cstdlib>

#include "ammonite/ammonite.hpp"
#include "ammonite/core/threadManager.hpp"

#include <atomic>

#include <thread>
#include <chrono>
#include <cstdlib>
#include <iostream>

#include "ammonite/ammonite.hpp"
#include "ammonite/core/threadManager.hpp"


void shortTask(void*) {
static void shortTask(void*) {
return;
}

Expand All @@ -32,13 +28,13 @@ int main() {
for (int i = 0; i < numJobs; i++) {
ammonite::thread::submitWork(shortTask, nullptr, &syncs[i]);
}
std::cout << "Submitted in " << runTimer.getTime() << "s" << std::endl;

//Wait for work to complete
for (int i = 0; i < numJobs; i++) {
ammonite::thread::waitWorkComplete(&syncs[i]);
}
std::free(syncs);

std::cout << "Completed in " << runTimer.getTime() << "s" << std::endl;

//Clean up and exit
Expand Down

0 comments on commit 31e8de1

Please sign in to comment.