Skip to content

Commit

Permalink
README: Describe design decision regarding thread-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
logmanoriginal committed Oct 6, 2024
1 parent 0a7b901 commit 9221503
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Although this project aims to provide complete bindings for libssh2, there are s

### Design Decisions

- **Thread Safety**: This project uses semaphores to ensure thread safety on a session level. This means that all functions on a session (including channels, subsystems, etc.) execute mutually exclusive (with few exceptions). This is done to ensure that the underlying libssh2 session (and by extension the underlying TCP connection) is not accessed concurrently, which could result in memory corruption and undefined behaviour. Note that this does not prevent callers from using multiple sessions concurrently. For example, a caller could use one session to execute a command and another session to transfer files without interering with each other.
- **Error Handling**: This project uses the LabVIEW error handling mechanism. All functions return an error cluster that corresponds to a libssh2 error code (see [lvssh2-errors.txt](/lvssh2-errors.txt) and [lvssh2-sftp-errors.txt](/lvssh2-sftp-errors.txt)). See [libssh2-api](docs/libssh2-api.md) for a complete overview of error codes and how they are defined.
- **Length Parameters for String and Array types**: All functions that take a string or array type as an input parameter do not expose a separate length parameter. Instead, the length of the string or array is determined by the type itself. Because of this, some of the libssh2 convenience functions are not included. For example, `libssh2_channel_window_write` is not included because it would be equivalent to `libssh2_channel_window_write_ex`. For a complete overview of the functions that are included, see [libssh2-api](docs/libssh2-api.md).
- **Pointer Handling**: Pointers are not exposed to the caller. Instead, the caller receives a Refnum that represents a Data Value Reference which contains the pointer. This is done to provide a more LabVIEW-like interface and to avoid pointer handling for the caller. Note that this also ensures 32-bit and 64-bit compatibility.
Expand Down

0 comments on commit 9221503

Please sign in to comment.