Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 1.36 KB

NOTES.md

File metadata and controls

20 lines (16 loc) · 1.36 KB

JDZ: here is where I am adding notes about library structure/design, This is while reorganizing code, fall quarter 2019

Startup sequence, threads, main() Student writes a main() function that appears to them to be the entry point for program, but this is sleight-of-hand. Student code is compiled with a #define to rename main to studentMain and linking with our library supplies a main() that call studentMain() wrapped in necessary startup/teardown code.

  • What happens in main wrapper?
    1. establishes the original thread as the "qtgui thread"
    2. initializes QT application
    3. initialize graphical console window (if #include console.h)
    4. create second thread to run studentMain, concurrently run QT application event loop on qtgui thread
    5. shutdown at end of studentMain and/or close console window
  • Threads A lot of the QT application/graphics interaction has to run on the qtgui thread, see GThread::runOnQtGuiThread for that dispatch
  • Autograder main An autograder should directly supply its own main(), it can simply call the autograderMain from library if appropriate.

Static variables (initialization, constructors)

  • No guarantees about order of execution code is run for static initializers. See private/static.h for macros that provide declaration/access to static variable to ensure initializer run exactly once on first use of variable.