Crate bitcoin_system

source ·

Structs

  • | StdLockGuard provides an annotated | version of std::lock_guard for us, | and should only be used when sync.h Mutex/LOCK/etc | are not usable. |
  • | StdMutex provides an annotated version | of std::mutex for us, and should only | be used when sync.h Mutex/LOCK/etc | are not usable. |

Constants

Functions

  • | Clear shutdown flag. Only use this during | init (before calling WaitForShutdown | in any thread), or in the unit tests. | Calling it in other circumstances will | cause a race condition. |
  • | Helper function to access the contained | object of a std::any instance. | | Returns a pointer to the object if passed | instance has a value and the type matches, | nullptr otherwise. |
  • | This function returns either one of EXIT_ codes | when it’s expected to stop the process or | CONTINUE_EXECUTION when it’s expected to | continue further.
  • Check that all of the input and output scripts of a transaction contains valid opcodes
  • | Reverse operation of DecodeDouble. | DecodeDouble(EncodeDouble(f))==f | unless isnan(f). |
  • | Encode a double using the IEEE 754 binary64 | format. All NaNs are encoded as x86/ARM’s | positive quiet NaN with payload 0. |
  • | Get the size of a file by scanning it. | | ———– | @param[in] path | | The file path | ––––– | @param[in] max | | Stop seeking beyond this limit | | ———– | @return | | The file size or max |
  • | Return the number of cores available | on the current system. | | ———– | @note | | This does count virtual cores, such | as those provided by HyperThreading. |
  • | Helper for Assert() |
  • | Application startup time (used for | uptime calculation) |
  • | Format a string that describes several | potential problems detected by the | core. | | ———– | @param[in] verbose | | bool | | - if true, get all warnings separated | by
    | | - if false, get the most important warning | | ———– | @return | | the warning string |
  • | Initialize shutdown state. This must | be called before using either StartShutdown(), | | AbortShutdown() or WaitForShutdown(). | Calling ShutdownRequested() is always | safe. |
  • | Simplification of std insertion |
  • | this function tries to raise the file | descriptor limit to the requested number. | | It returns the actual file descriptor | limit (which may be more or less than | nMinFD) |
  • Taken from https://gist.github.com/arvidsson/7231973
  • | Release all directory locks. This is | used for unit testing only, at runtime | the global destructor will take care | of the locks. |
  • | Execute a command which returns JSON, | and parse the result. | | ———– | @param str_command | | The command to execute, including any | arguments | ––––– | @param str_std_in | | string to pass to stdin | | ———– | @return | | parsed JSON |
  • | On platforms that support it, tell the | kernel the calling thread is | | CPU-intensive and non-interactive. | See SCHED_BATCH in sched(7) for details. |
  • | Set the thread’s name at the process | level. Does not affect the internal | name. |
  • | Returns true if a shutdown is requested, | false otherwise. |
  • | Parse a constant. | | If sp’s initial part matches str, sp | is updated to skip that part, and true | is returned. | | Otherwise sp is unmodified and false | is returned. |
  • | Extract the expression that sp begins | with. | | This function will return the initial | part of sp, up to (but not including) | the first comma or closing brace, skipping | ones that are surrounded by braces. | So for example, for “foo(bar(1),2),3” | the initial part “foo(bar(1),2)” will | be returned. sp will be updated to skip | the initial part that is returned. |
  • | Parse a function call. | | If sp’s initial part matches str + “(”, | and sp ends with “)”, sp is updated to | be the section between the braces, and | true is returned. Otherwise sp is unmodified | and false is returned. |
  • | Split a string on every instance of sep, | returning a vector. | | If sep does not occur in sp, a singleton | with the entirety of sp is returned. | | ———– | @note | | this function does not care about braces, | so splitting “foo(bar(1),2),3) on | ‘,’ will return {“foo(bar(1)”, “2)”, | “3)”}. |
  • | Request shutdown of the application. |
  • | Get the thread’s internal (in-memory) | name; used e.g. for identification | in logging. |
  • | Rename a thread both in terms of an internal | (in-memory) name as well as its system thread | name. | | @note Do not call this for the main thread, as | this will interfere with UNIX utilities such | as top and killall. Use ThreadSetInternalName | instead.
  • | Set the internal (in-memory) name of | the current thread only. |
  • | Ignores exceptions thrown by Boost’s | create_directories if the requested | directory exists. | | Specifically handles case where path | p exists, but it wasn’t possible for | the user to write to the parent directory. |
  • | Construct a vector with the specified | elements. | | This is preferable over the list initializing | constructor of std::vector: | | - It automatically infers the element | type from its arguments. | | - If any arguments are rvalue references, | they will be moved into the vector (list | initialization always copies). |
  • | Wait for StartShutdown to be called | in any thread. This can only be used from | a single thread. |
  • | Write contents of std::string to a file. | | ———– | @return | | true on success. |

Type Definitions