Git Product home page Git Product logo

common's Introduction

Hydro Common

This repository is a shared repository for header files, protobuf definitions, and scripts. It is linked into other repositories in the Hydro project using git submodules. This README provides a brief overview of the contents of this repository. This repository will not change frequently and should only contain code that is used across multiple Hydro subprojects.

  • cmake: This directory has three helpers that are useful for any CMake-based project: CodeCoverage.cmake uses lcov and gcov to automatically generate coverage information; DownloadProject.cmake automatically downloads and configured external C++ dependencies; and clang-format.cmake automatically runs the clang-format tool on all C++ files in a project.
  • include: A variety of Hydro C++ header files, including shared lattice definitions, a Anna KVS client, shared typedefs and other utilities.
  • proto: Project API-level protobuf definitions.
  • scripts: Various helper scripts that install dependencies and simplify creating Travis build processes.
  • vendor: CMake configuration for Hydro vendor dependencies (ZeroMQ, SPDLog, and Yaml-CPP).

common's People

Contributors

cw75 avatar jeffi avatar marcopolo avatar vsreekanti avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

common's Issues

Double increment of request id

Hi, I was browsing the code to try and understand it more, and I saw in kvs_client.hpp the method get_request_id()

  /**
   * Generates a unique request ID.
   */
  string get_request_id() {
    if (++rid_ % 10000 == 0) rid_ = 0;
    return ut_.ip() + ":" + std::to_string(ut_.tid()) + "_" +
           std::to_string(rid_++);
  }

It looks to me like you are pre-incrementing rid_ in the comparison to 1000, then post-incrementing it when forming the string at the end, so double incrementing it each time.

It's not like that should be a problem if you just want a unique number each time, but I wanted to mention it to see if I understood it correctly, or learn there is a reason for incrementing the request ID by 2 each time.

BTW: If this method is used by multiple threads without some locking/atomic mechanism outside this method, then there is a potential race condition here, no?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.