demo: Keep a pointer to dev_context in sr_dev_inst and vice-versa
session: Make sr_session_stop thread-safe

With the sigrok session running in a worker thread, if sr_session_stop is called
from another thread, it shuts down the pollfds used by the hardware drivers,
without ensuring that the sigrok event loop is no longer using those pollfds.

On the demo driver, this involves shutting down the GIOChannels, causing a
segfault when the sigrok event loop tries to use them. This is evident when
using the Stop button in PulseView, while the session is running.

This isn't a problem with just the demo driver; any driver's resources may be
freed by sr_session_stop concurrently with the sigrok session running.

To solve this problem, we don't touch the session itself in sr_session_stop().
Instead, we mark it for decommissioning and return. The session polls this flag,
and shuts itself down when requested.

This fixes bug 4.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
demo: Moved demo configuration variables into dev_context