Skip to content

Commit 690040a

Browse files
committed
Update WorkContractExample.cpp
1 parent 86c07cd commit 690040a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Examples/WorkContractExample.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,28 @@
22
// Created by Geenz on 8/8/25.
33
//
44

5+
56
#include "WorkContractExample.h"
67
#include <iostream>
78
#include "../src/Concurrency/WorkContractGroup.h"
9+
#include "../src/Concurrency/WorkService.h"
810
using namespace EntropyEngine;
911
using namespace Core;
1012
using namespace Concurrency;
1113

1214
int main() {
15+
WorkService service{WorkService::Config()};
16+
service.start();
17+
WorkContractGroup group(1000);
18+
19+
for (int i = 0; i < 1000; i++) {
20+
group.createContract([=]() {
21+
printf("WorkContractGroup createContract %i\n", i);
22+
}).schedule();
23+
}
24+
service.addWorkContractGroup(&group);
25+
group.wait();
26+
27+
service.stop();
1328
return 0;
1429
}
15-

0 commit comments

Comments
 (0)