Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(gossip,tar): Work towards improving thread management #145

Merged
merged 7 commits into from
Jun 3, 2024

Commits on May 31, 2024

  1. Configuration menu
    Copy the full SHA
    ce31583 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d0307e1 View commit details
    Browse the repository at this point in the history
  3. Thread/task management improvements

    * [ThreadPoolTask] Rename `done` field to `avaialable`, for better
      clarity in the contexts it's used.
    
    * [ThreadPoolTask] Add `awaitAndAcquireFirstAvailableTask` &
      `blockUntilCompletion` functions, remove `queue` function,
      replace usages of `queue` and code which would now duplicate
      the aforementioned additions.
    
    * [ThreadPoolTask] Add `result` field for signalling the result
      of the callback.
    
    * [gossip] Make use of `ThreadPoolTask` instead of manually implementing
      the VerifyMessageTask Task interface details.
    
    * [gossip] Add `GOSSIP_VERIFY_PACKET_PARALLEL_TASKS` constant, and use
      it instead of hardcoding the tasks allocated in `verifyPackets`.
    
    * [gossip] Make `verifyPackets` and `processMessages` accept an
      a shared allocator, and make `run` provide a thread-safe allocator
      which will only be contended by a maximum of the avilable tasks
      plus the number of messages processed at the same time.
    
    * [tar] Panic on some invalid but possible invariants.
    
    * Constify more things that don't need to be mutable.
    InKryption committed May 31, 2024
    Configuration menu
    Copy the full SHA
    3b7b21b View commit details
    Browse the repository at this point in the history
  4. Improve & simplify socket_utils

    * Rename `SOCKET_TIMEOUT` to `SOCKET_TIMEOUT_US`, to signify its
      magnitude is in microseconds.
    
    * Remove `recvMmsg` and simplify the timeout logic to simply setting
      it directly before the loop, and finishing the batch on the first
      `error.WouldBlock` when the batch isn't empty.
    
    * Use `packet_batch` as an actual arraylist instead of as a weird slice.
    InKryption committed May 31, 2024
    Configuration menu
    Copy the full SHA
    0fdd396 View commit details
    Browse the repository at this point in the history
  5. Return thread handles from new runThreads

    Re-implement the logic of `run` as a function that returns the handles
    which can then be joined by the caller.
    Most usage sites require a bit of thought with respect to the
    order of operations, so `GossipService.run` remains as a wrapper
    around the new logic.
    This also makes it take a `message_allocator`.
    InKryption committed May 31, 2024
    Configuration menu
    Copy the full SHA
    570ee93 View commit details
    Browse the repository at this point in the history

Commits on Jun 3, 2024

  1. Style fixes & refactors

    InKryption committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    570bf3e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    eba9783 View commit details
    Browse the repository at this point in the history