Mir

Code review comment for lp://qastaging/~afrantzis/mir/client-api-platform-operation-spike

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

Without seeing plausible code that uses this I'm not convinced that the ref counting scheme is useful.

I see several "simpler" options:

1. never pass "ownership" to the client and require them to save anything they want. That could simply be:
    void* mir_platform_message_take_data(message, &size) and
    int* mir_platform_message_take_fds(message, &nfds)

...

    free(data);

    for (int* fd = fds; fd != fds+nfds; ++fd) close(*fd);
    free(fds);

2. always pass "ownership" and require mir_platform_message_release(message) to be called

3. Have the callback return a bool indicating whether ownership has been taken. (Which, at least, gives a compile error if no decision is taken.)

But I'm ready to be told that all the above are simplistic and ref counting is a requirement.

review: Needs Information

« Back to merge proposal