Failing spec for Msf::Framework.new threads

MSP-11605

`Msf::Framework.new` creates 8 threads (change from 1 thread to 9 threads), but
it shouldn't create any threads.
Merge branch 'feature/MSP-11147/thread-leak-detection' into feature/MSP-11605/lazy-thread-creation

MSP-11605
Use MonitorMixing in Msf::Framework

MSP-11605

To get access to `#synchronize` for thread-safe lazy initialization.
Thread-safe lazy Msf::Framework#threads

MSP-11605

Switch Msf::Framework#threads to a custom method that uses `||=` to
lazily initialize the `Msf::ThreadManager` inside a `synchronize` block
to make it thread safe.
Thread-safe lazy Msf::Framework#sessions

MSP-11605

Switch `Msf::Framework#sessions` from being set in `#initialize` to a
custom method that uses `||=` to lazily initialize the
`Msf::SessionManager` inside a `synchronize` block to make it thread
safe.
Store Msf::Framework#initialize options

MSP-11605

Store options `Hash` passed to `Msf::Framework#new` in `#options` so
that lazily initialized children, such as DBManager, have access to
those options.
Thread-safe lazy Msf::Framework#db

MSP-11605

Switch `Msf:Framework#db` from being set in `#initialize` to a custom
method that uses `||=` to lazily initialize the `Msf::DBManager` inside
a `synchronize` block to make it thread safe.
Wrap Msf::Framework#threads in Metasploit::Framework::ThreadFactoryProvider

MSP-11605

`Rex::ThreadFactory.provider` needs to be set in
`Msf::Framework#initialize`, but setting it directly to
`Msf::Framework#threads` eliminates the laziness of
`Msf::Framework#threads`.  In order keep `framework.threads` lazy,
`framework` is wrapped in a
`Metasploit::Framework::ThreadFactoryProvider`, which responds to
`spawn`, which is needed by `Rex::ThreadFactory`, by calling
`framework.threads.spawn`, which lazily initialized `framework.threads`
when the first thread needs to be spawned.
Msf::Framework#threads?

MSP-11605

`Msf::Framework#threads?` returns whether `Msf::Framework#threads` was
ever initialized.  If `Msf::Framework#threads?` is true, then threads
need to be cleaned up, while if it is false then no threads need to be
cleaned up from the current framework.
Fail if 'Msf::Framework#threads cleaner' is unnecessary

MSP-11605

The 'Msf::Framework#threads cleaner' shared context fails with a
RuntimeError if `framework.threads?` is false, which would indicate that
cleaning is unnecessary.  This change stops 'Msf::Framework#threads
cleaner' from accessing `framework.threads`, which would create threads
only to immediately clean them up.
Remove unnecessary thread cleaning from Msf::Framework spec

MSP-11605
Remove thread cleaner from Msf::Simple::Framework shared context

MSP-11605

The `framework` from 'Msf::Simple::Framework' shared context is not
guaranteed to make threads with `framework.threads` anymore, so the
cleaner shouldn't allows be present in 'Msf::Simple::Framework'.
Merge branch 'master' into feature/MSP-11605/lazy-thread-creation

MSP-11605
Merge branch 'chore/MSP-11614/remove-msf-db-manager-sink' into feature/MSP-11605/lazy-thread-creation

MSP-11605

Conflicts:
	spec/lib/msf/core/task_manager_spec.rb
Remove unnecessary thread cleaning from Msfcli spec

MSP-11605
Merge branch 'master' into feature/MSP-11605/lazy-thread-creation

MSP-11605
Merge branch 'master' into feature/MSP-11605/lazy-thread-creation

MSP-11605
Merge branch 'feature/MSP-11147/thread-leak-detection' into feature/MSP-11605/lazy-thread-creation

MSP-11605
Merge branch 'landing/4207' into upstream-master

Land #4207

* Ensure that `rake spec` doesn't create too many threads