mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 20:47:08 +03:00
no mutex needed for polling - release
This commit is contained in:
@@ -199,7 +199,6 @@ static void *stream_thread() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
polling = true;
|
|
||||||
pollinfo.fd = fd;
|
pollinfo.fd = fd;
|
||||||
pollinfo.events = POLLIN;
|
pollinfo.events = POLLIN;
|
||||||
if (stream.state == SEND_HEADERS) {
|
if (stream.state == SEND_HEADERS) {
|
||||||
@@ -208,6 +207,8 @@ static void *stream_thread() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UNLOCK;
|
UNLOCK;
|
||||||
|
// no mutex needed - we just want to know if we are inside poll()
|
||||||
|
polling = true;
|
||||||
|
|
||||||
if (_poll(ssl, &pollinfo, 100)) {
|
if (_poll(ssl, &pollinfo, 100)) {
|
||||||
|
|
||||||
@@ -364,7 +365,6 @@ static void *stream_thread() {
|
|||||||
UNLOCK;
|
UNLOCK;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// it is safe to set it unlocked
|
|
||||||
polling = false;
|
polling = false;
|
||||||
LOG_SDEBUG("poll timeout");
|
LOG_SDEBUG("poll timeout");
|
||||||
}
|
}
|
||||||
@@ -490,8 +490,7 @@ void stream_sock(u32_t ip, u16_t port, const char *header, size_t header_len, un
|
|||||||
|
|
||||||
#if EMBEDDED
|
#if EMBEDDED
|
||||||
// wait till we are not polling anymore
|
// wait till we are not polling anymore
|
||||||
for (LOCK; running && polling; UNLOCK, usleep(10000), LOCK);
|
while (polling && running) { usleep(10000); }
|
||||||
UNLOCK;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user