extmod/uasyncio: Rename internal _flag to state, to save a qstr.

Saves about 16 bytes of flash when uasyncio is frozen in.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-08-12 17:03:38 +10:00
parent 5543b2a9cc
commit 01514e80c9
1 changed files with 6 additions and 6 deletions

View File

@ -42,23 +42,23 @@ try:
class ThreadSafeFlag(uio.IOBase):
def __init__(self):
self._flag = 0
self.state = 0
def ioctl(self, req, flags):
if req == 3: # MP_STREAM_POLL
return self._flag * flags
return self.state * flags
return None
def set(self):
self._flag = 1
self.state = 1
def clear(self):
self._flag = 0
self.state = 0
async def wait(self):
if not self._flag:
if not self.state:
yield core._io_queue.queue_read(self)
self._flag = 0
self.state = 0
except ImportError:
pass