← Back to team overview

desktop-packages team mailing list archive

[Bug 1194384] Re: Mir client callbacks are not thread-safe

 

** Project changed: xmir => xorg-server (Ubuntu)

** Tags added: xmir

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to xorg-server in Ubuntu.
https://bugs.launchpad.net/bugs/1194384

Title:
  Mir client callbacks are not thread-safe

Status in Mir:
  Triaged
Status in xorg-server package in Ubuntu:
  Confirmed

Bug description:
  Mir clients may not be aware, but the callbacks made by libmirclient
  are not thread safe in any way.

  An apparently simple single-threaded Mir client has 3 threads, which
  can execute concurrently:

  1. The "main" thread, where the initial connection was made.
  2. The socket thread, where the protocol is handled (mir_connected_callback, mir_surface_callback, MirSurfaceEvent)
  3. The input thread, where input events are received (MirMotionEvent, MirKeyEvent)

  Yes, you could receive a MirSurfaceEvent and MirMotionEvent
  simultaneously in different threads. Neither of which are the main
  thread.

  This is how a Mir client works. Unfortunately the existence of these
  threads is not yet documented. I will update the docs. But this bug is
  really about finding a way to make the client API more thread safe for
  simple toolkits and clients that normally don't care about threads.
  UPDATE: Client API docs improved in r789.

  To make matters worse, the client API functions are generally not
  thread safe either: mir_surface_* mir_connection_*. So libmirclient
  forces you to run in multiple threads and yet doesn't protect you at
  all against races and corruption that could arise from calling
  libmirclient from varying threads. UPDATE: Fixed in r827

To manage notifications about this bug go to:
https://bugs.launchpad.net/mir/+bug/1194384/+subscriptions