mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-30 22:53:59 +00:00 
			
		
		
		
	tidy
This commit is contained in:
		| @@ -29,7 +29,7 @@ void SchedulerRapidCancellationComponent::run_rapid_cancellation_test() { | ||||
|   threads.reserve(NUM_THREADS); | ||||
|  | ||||
|   for (int thread_id = 0; thread_id < NUM_THREADS; thread_id++) { | ||||
|     threads.emplace_back([this, thread_id]() { | ||||
|     threads.emplace_back([this]() { | ||||
|       for (int i = 0; i < OPERATIONS_PER_THREAD; i++) { | ||||
|         // Use modulo to ensure multiple threads use the same names | ||||
|         int name_index = i % NUM_NAMES; | ||||
|   | ||||
| @@ -48,7 +48,7 @@ void SchedulerSimultaneousCallbacksComponent::run_simultaneous_callbacks_test() | ||||
|         std::string name = ss.str(); | ||||
|  | ||||
|         // Schedule callback for exactly DELAY_MS from now | ||||
|         this->set_timeout(name, DELAY_MS, [this, thread_id, i, name]() { | ||||
|         this->set_timeout(name, DELAY_MS, [this, name]() { | ||||
|           // Increment concurrent counter atomically | ||||
|           int current = this->callbacks_at_once_.fetch_add(1) + 1; | ||||
|  | ||||
|   | ||||
| @@ -59,19 +59,19 @@ void SchedulerStringNameStressComponent::run_string_name_stress_test() { | ||||
|         // Also test nested scheduling from callbacks | ||||
|         if (j % 10 == 0) { | ||||
|           // Every 10th callback schedules another callback | ||||
|           this->set_timeout(dynamic_name, delay, [component, i, j, callback_id]() { | ||||
|           this->set_timeout(dynamic_name, delay, [component, callback_id]() { | ||||
|             component->executed_callbacks_.fetch_add(1); | ||||
|             ESP_LOGV(TAG, "Executed string-named callback %d (nested scheduler)", callback_id); | ||||
|  | ||||
|             // Schedule another timeout from within this callback with a new dynamic name | ||||
|             std::string nested_name = "nested_from_" + std::to_string(callback_id); | ||||
|             component->set_timeout(nested_name, 1, [component, callback_id]() { | ||||
|             component->set_timeout(nested_name, 1, [callback_id]() { | ||||
|               ESP_LOGV(TAG, "Executed nested string-named callback from %d", callback_id); | ||||
|             }); | ||||
|           }); | ||||
|         } else { | ||||
|           // Regular callback | ||||
|           this->set_timeout(dynamic_name, delay, [component, i, j, callback_id]() { | ||||
|           this->set_timeout(dynamic_name, delay, [component, callback_id]() { | ||||
|             component->executed_callbacks_.fetch_add(1); | ||||
|             ESP_LOGV(TAG, "Executed string-named callback %d", callback_id); | ||||
|           }); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user