luat_network_idf5.c 492 B

12345678910111213141516171819202122
  1. #include "luat_base.h"
  2. #ifdef LUAT_USE_NETWORK
  3. #include "luat_network_posix.h"
  4. #include "freertos/FreeRTOS.h"
  5. #include "freertos/task.h"
  6. static void client_entry(void* args) {
  7. posix_socket_t *ps = (posix_socket_t*)args;
  8. posix_network_client_thread_entry(ps);
  9. vTaskDelete(NULL);
  10. }
  11. int network_posix_client_thread_start(posix_socket_t* ps){
  12. int err = xTaskCreate(client_entry, "socket", 4096, ps, 30, NULL);
  13. if (err == pdPASS)
  14. return 0;
  15. return -1;
  16. }
  17. #endif