Mir

Merge lp://qastaging/~vanvugt/mir/super-simple-connect into lp://qastaging/~mir-team/mir/trunk

Proposed by Daniel van Vugt
Status: Merged
Approved by: Robert Ancell
Approved revision: no longer in the source branch.
Merged at revision: 506
Proposed branch: lp://qastaging/~vanvugt/mir/super-simple-connect
Merge into: lp://qastaging/~mir-team/mir/trunk
Diff against target: 86 lines (+47/-0)
3 files modified
include/client/mir_toolkit/mir_client_library.h (+8/-0)
src/client/mir_client_library.cpp (+18/-0)
tests/acceptance-tests/test_client_library.cpp (+21/-0)
To merge this branch: bzr merge lp://qastaging/~vanvugt/mir/super-simple-connect
Reviewer Review Type Date Requested Status
Chris Halse Rogers Approve
Robert Ancell Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+153307@code.qastaging.launchpad.net

Commit message

Prototype a super-simple synchronous wrapper for mir_connect().

Description of the change

Other client API functions will be converted pending agreement on the general approach.

But for the record, I don't like this proposal. I prefer:
  lp:~vanvugt/mir/optional-callbacks
but have been told this approach here is more likely to get approved.

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I suspect someone will complain about reinterpret_cast. But consider the alternative with N callbacks (one for each API function) and each having to contain its own:
   *(static_cast<MirSomething**>(context)) = something;

I prefer the reinterpret_cast.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

This is pretty much what I was thinking of doing - although I was was going to prefix with "s" not suffix with "_sync", and wasn't going to use reinterpret_cast.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> This is pretty much what I was thinking of doing - although I was was going to
> prefix with "s" not suffix with "_sync", and wasn't going to use
> reinterpret_cast.

Oh, and I was going to use a separate header.

Revision history for this message
Kevin DuBois (kdub) wrote :

i like it. slight preference for suffixed names (as it is), no reinterpret, and a separate header

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

It's true that making up new words like "sconnect" is one way to avoid ambiguity. But it steepens the learning curve. Another possible convention is "mir_connect_now", which is a clear message to the reader that "mir_connect" might not connect /right now/.

Separate headers? I disagree. This function relates directly to the existing contents of mir_client_library.h. Separate headers would also steepen the learning curve and it would be generally bad design to have a "connect" function in a different header to its requisite disconnect function.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> It's true that making up new words like "sconnect" is one way to avoid
> ambiguity. But it steepens the learning curve. Another possible convention is
> "mir_connect_now", which is a clear message to the reader that "mir_connect"
> might not connect /right now/.
>
> Separate headers? I disagree. This function relates directly to the existing
> contents of mir_client_library.h. Separate headers would also steepen the
> learning curve and it would be generally bad design to have a "connect"
> function in a different header to its requisite disconnect function.

To clarify: I'm not blocking your approach. Just that I would have defined smir_connect(..) and smir_disconnect(..) and the rest of a synchronous API in a separate and independent header.

Revision history for this message
Robert Ancell (robert-ancell) wrote :

Looks good to me. I think *_sync is better than s* (it's more clear what "sync" means over "s") and don't see a need to use another header file.

review: Approve
Revision history for this message
Chris Halse Rogers (raof) wrote :

Another +1 for *_sync vs s*.

I'm not averse to having a separate, synchronous, header, but I think that as long as we maintain the convention of having _sync stuck on the end of anything that can block it's not particularly necessary.

If you call mir_connect_sync, it's pretty clear you don't want asynchronous behaviour, so I don't think we need to segregate the sync calls out for client's safety.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches