Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !708

WIP: GPollableOutputstream: Extend the API to avoid allocating GErrors for WOULD_BLOCK

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Jordan Petridis requested to merge alatiera/glib:alatiera/pollable-no-wouldblock-allocations into master Mar 05, 2019
  • Overview 47
  • Commits 9
  • Pipelines 24
  • Changes 10

Currently GPollalbeOutputStream->writev_nonblocking always allocates a GError for _WOULD_BLOCK results. This is not much efficient and can be quite expensive in networking scenarios. This MR extends the GPollalbeOutputStream interface with an optional method that behaves identical to write_nonblockin but returns a GPollableReturn. The GError is only allocated if the result is _FAILURE variant of GPollableReturn.

Additionally all the existing implementors of GPollalbeOutputStream in gio are extended to make use of the new API, to do that g_socket_send_with_timeout from gsocket was needed to become public.

Since the default implementation of g_pollable_output_stream_write_nonblocking was switched to use _pollable if available, that means it also stole the test coverage from GPollalbeOutputStream->writev_nonblocking which was only tested indirectly. I am not sure how to introduce new tests for this since I don't think it was tested direclty. Extra help there would be much appreciated ^^.

g_pollable_output_stream_write_nonblocking_pollable is a terrible name, but I couldn't come up with anything better. Feel free to bikeshed it :)

Also, note d8dc9d34, this MR is intended for 2.62+ but needed to get the CI to pass.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: alatiera/pollable-no-wouldblock-allocations