# mPy - demonstrating simple cooperative multitasking
# Copyright by Anthony Vogelaar, Perth Scotland
# rev 010  2025-10-06  initial release

import	time
import	asyncio

# ============================== demo ===============================

# print '@' @ 1 Sec
async def task1():
    while True:
        print('@', end='')
        await asyncio.sleep(1)


# print '*' @ 0.5 Sec
async def task2():
    while True:
        print('*', end='')
        await asyncio.sleep(0.5)


# print '.' @ 0.25 Sec
async def task3():
    while True:
        print('.', end='')
        await asyncio.sleep(0.25)


# main loop executing task1, task2 and task3
def main():
    
    async def loop():
        await asyncio.gather(task1(), task2(), task3())
        
        
    try:
        asyncio.run(loop())
    except: 
        print('\napplication terminated')


main()

# ============================== end ===============================
