• src/sbbs3/ctrl/MainFormUnit.cpp

    From Rob Swindell (on Windows 11)@VERT to Git commit to main/sbbs/master on Sun Jun 21 20:54:25 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/0413292545602068f2591c10
    Modified Files:
    src/sbbs3/ctrl/MainFormUnit.cpp
    Log Message:
    sbbsctrl: count total_users() on a background thread, not the GUI thread

    TMainForm::StatsTimerTick() called total_users() directly on the VCL message-pump thread. total_users() walks the entire user base, reading
    every record (a lock/read/unlock per user); on a large base - especially a network-mounted data_dir - that is slow, and while the servers are busy
    (e.g. a web scrape saturating the file share) it froze the GUI for seconds
    at a time. 1eb9328327 (limited-19-blackjack) reduced how often the scan
    runs, but throttling frequency can't stop an individual O(N) blocking scan
    from freezing the UI when it does run.

    Run the scan on a short-lived background thread (_beginthread, matching the server-launch threads in this file). The worker never touches the VCL: it publishes the count, and StatsTimerTick() picks it up on a later tick. The existing frequency guard and the !StatsForm->Visible early-return are kept,
    so a hidden Stats window still scans nothing and at most one scan runs at a time.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net