[Spice-devel] [PATCH spice-streaming-agent v4 0/5] Add a SpiceStream class for stream access

Christophe de Dinechin christophe at dinechin.org
Fri Nov 10 15:15:41 UTC 2017


From: Christophe de Dinechin <dinechin at redhat.com>

Add a SpiceStream that owns the actual stream.
This has several benefits:

1. It makes it possible to use proper RAII to deal
   with the lifetime of the stream file descriptor

2. It opens the door for dealing with multiple streams

3. It removes one global with associated race conditions

A pre-existing race conditions when creating the thread
that processes cursor data is eliminated as a side effect.

Changes in v2:

* Extended the role of SpiceStream struct to encapsulate streamfd
* Fixed a pre-existing race condition when starting cursor thread

Changes in v3:

* Change SpiceStream to a class
* A couple of int->bool adjustments
* Made write_all private and use streamfd
* Remove test for streamfd<0 in dtor

Changes in v4:

* Fixed indentation

Christophe de Dinechin (5):
  style: Remove useless whitespace
  style: Use C++ style for declaring structs
  Switch 'blocking' flag to bool
  Use RAII to cleanup stream in case of exception or return
  Move all stream-related functions within SpiceStream class

 src/spice-streaming-agent.cpp | 112 +++++++++++++++++++++++++-----------------
 1 file changed, 66 insertions(+), 46 deletions(-)

-- 
2.13.5 (Apple Git-94)



More information about the Spice-devel mailing list