"'vTaskDelay' was not declared in this scope" on ESP8266

This

void setup() {
  // put your setup code here, to run once:
  xTaskCreate([](void * p) {
    for (int i = 0; i < 10; i++) {
      Serial.println(String("i=") + i);
      vTaskDelay(pdMS_TO_TICKS(1000));
    }
    vTaskDelete(NULL);
  }, "t1", 10000, (int *)1, 0, NULL);
}

void loop() {
  // put your main code here, to run repeatedly:

}

fails to compile on ESP8266 with ‘pdMS_TO_TICKS’ was not declared in this scope,
but on ESP32 it compiles successfully.
None of the functions xTaskCreate, vTaskDelay, pdMS_TO_TICKS or vTaskDelete, are found on ESP8266.

Why is that?

The native OS for the ESP32 is freeRTOS. The 8266 does not have a native OS.

BTW, you do not need to call, in the Arduino IDE, the macro pdMS_TO_TICKS, the ESP32 converts the number pdMS_TO_TICKS(X) mSec automatically.

Idahowalker:
The native OS for the ESP32 is freeRTOS. The 8266 does not have a native OS.

Ah, ok. So here is another following question. This

	system_os_task([](os_event_t *e) {
		for (int i = 0; i < 10; i++) {
			Serial.println(String("i=") + i);
			delay(1000);
		}
	}, 0, g_my_queue, 1);
	system_os_post(0, 0, 0);

compiles successfully in ESP8266, but the delay() has no effect, all lines are printed at once.
Any way to delay in a task on ESP8266 like it does on ESP32?