We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f067ea commit 4c2a0feCopy full SHA for 4c2a0fe
apps/examples/workers/main.c
@@ -277,10 +277,11 @@ int main(void) {
277
am_ao_init_subscribe_list(m_pubsub_list, AM_COUNTOF(m_pubsub_list));
278
279
int ncpus = am_pal_get_cpu_count();
280
- AM_ASSERT(ncpus <= AM_WORKERS_NUM_MAX);
281
- AM_ASSERT(ncpus <= AM_AO_NUM_MAX);
282
am_pal_printf("Number of CPUs: %d\n", ncpus);
283
+ ncpus = AM_MIN(ncpus, AM_WORKERS_NUM_MAX);
+ ncpus = AM_MIN(ncpus, AM_AO_NUM_MAX);
284
+
285
balancer_ctor(/*nworkers=*/ncpus);
286
for (int i = 0; i < ncpus; ++i) {
287
worker_ctor(&m_workers[i], /*id=*/i);
0 commit comments