Creating a Blocking Thread on espconn_gethostbyname
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Creating a Blocking Thread on espconn_gethostbyname
Postby AgentSmithers » Sun Jul 08, 2018 7:41 am
Anyone know of a useful way to make the command espconn_gethostbyname a blocking thread. I've tried using a while loop on a Global Bool var but no dice. Does anyone have a workaround?
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: Creating a Blocking Thread on espconn_gethostbyname
Postby AgentSmithers » Tue Jul 31, 2018 7:22 am
Everyone, I wanted to circle back and say at this point in time I am convinced this is not possible due to internal processes that take place once the code returns to the SDK internal calls. I required this to simplify the call tree being created depending on the circumstances but at this point, I have to store a checkpoint/marker as a Global Variable to return to the correct location.
Re: Creating a Blocking Thread on espconn_gethostbyname
Postby Pato » Thu Aug 02, 2018 10:24 pm
Hey,
I am also studying a way to do a kind of wait() or delay() that would block the execution of my function while letting the SDK do its background tasks like Wifi and TCP processing.
I've found very intersesting things in the ESP support for Arduino IDE: their great guys have built this exact same function with some pieces of assembler to switch context and stack (https://github.com/esp8266/Arduino/blob ... 6_main.cpp)
You can grep "esp_yield" on this whole Git repo to see how they achieved this, I'm also doing so to understand their tricks, you may figure out a solution for you
Good luck
I am also studying a way to do a kind of wait() or delay() that would block the execution of my function while letting the SDK do its background tasks like Wifi and TCP processing.
I've found very intersesting things in the ESP support for Arduino IDE: their great guys have built this exact same function with some pieces of assembler to switch context and stack (https://github.com/esp8266/Arduino/blob ... 6_main.cpp)
You can grep "esp_yield" on this whole Git repo to see how they achieved this, I'm also doing so to understand their tricks, you may figure out a solution for you

Good luck
Last edited by Pato on Fri Aug 03, 2018 3:55 pm, edited 1 time in total.
-
- Posts: 195
- Joined: Sat Apr 01, 2017 1:21 am
- Contact:
Re: Creating a Blocking Thread on espconn_gethostbyname
Postby AgentSmithers » Thu Aug 02, 2018 11:08 pm
Pato wrote:Hey,
I am also studying a way to do a kind of wait() or delay() that would block the execution of my function while letting the SDK do its background tasks like Wifi and TCP processing.
I've found very intersesting things in the ESP support for Arduino IDE: their great guys heve build this exact same function with some pieces of assembler to switch context and stack (https://github.com/esp8266/Arduino/blob ... 6_main.cpp)
You can grep "esp_yield" on this whole Git repo to see how they achieved this, I'm also doing so to understand their tricks, ou may figure out a solution for you
Good luck
Yeah, In X86 ASM we use PUSHAD and POPAD to store all the CPU Vars onto the stack You can then set your pointer to another function to pop the var's and assume that it's pretty much where it left off. Not sure if we have that here as a possibility.
*Update* After searching the forum I did find this sniblet so it's doable in 'C'. Maybe we can do a pushpop trick to resume where we started. Tottally a unsupported hack attempt but could be fun

For turning on GPIO
Code: Select all
__asm__ volatile ("movi a2, 0x60000304\n"
"movi a4, %0\n"
"memw\n"
"s32i a4, a2, 0\n"
::"r" (setbits):"a2", "a4");
setbits is a static uint16;
Who is online
Users browsing this forum: No registered users and 127 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.