A commonly used and robust life-cycle pattern consists of the following
4 steps:
1) create (allocate resources)
2) start (mark resources as safe for use)
3) stop (mark resources as unsafe for use)
4) destroy (deallocate resources)
This pattern effectively prevents access to uninitialized and freed
resources. While the dispatcher psoc life-cycle follows this pattern,
the global life-cycle is condensed into steps 1 and 4. Unsurprisingly,
this led to uninitialized and freed resource access problems, especially
in regards to the scheduler thread.
Split the scheduler init and deinit life-cycle functions into init,
enable, disable, and deinit. Create new global enable and disable
dispatcher functions, and call the new scheduler APIs as appropriate.
This brings the global dispatcher life-cycle in line with the existing
psoc life-cycle, and prevents many scheduler related resource access
issues.
Change-Id: I58b65be0611f48e48354f28c221185f6f490f30c
CRs-Fixed: 2153283