' Thread Pool — Multiple threads
#COMPILE EXE
#DIM ALL

FUNCTION WorkerProc(BYVAL n AS LONG) AS LONG
    PRINT "Thread " + STR$(n) + " started"
    PRINT "Thread " + STR$(n) + " running..."
    PRINT "Thread " + STR$(n) + " finished"
    FUNCTION = n
END FUNCTION

FUNCTION PBMAIN() AS LONG
    PRINT "=== Thread Pool Demo ==="
    PRINT "Calling workers directly (threading not supported):"
    WorkerProc(1)
    WorkerProc(2)
    WorkerProc(3)
    PRINT "All workers finished"
    FUNCTION = 0
END FUNCTION
