Skip to content

Comments

[ate]: Remove client singleton and support multiple instances#241

Merged
moidx merged 1 commit intolowRISC:mainfrom
moidx:ate-client-no-load-balancing
Jun 24, 2025
Merged

[ate]: Remove client singleton and support multiple instances#241
moidx merged 1 commit intolowRISC:mainfrom
moidx:ate-client-no-load-balancing

Conversation

@moidx
Copy link
Collaborator

@moidx moidx commented Jun 24, 2025

This commit refactors the ATE client library to remove the singleton pattern to enable downstream users to manage multiple client instances.

Previously, CreateClient would always return the same client instance, making it impossible to connect to multiple, distinct provisioning servers from a single application. The singleton implementation also had a potential race condition in the CreateClient call.

This change introduces the following:

  • The ate_dll.cc no longer uses a static client. Each call to CreateClient now returns a new, independent client instance.
  • Callers are now responsible for managing the lifecycle of each client and must call DestroyClient for every instance created.
  • The documentation in ate_api.h and ate.md has been updated to reflect the new factory pattern, and a guide has been added for managing multiple client instances.

This commit refactors the ATE client library to remove the singleton
pattern to enable downstream users to manage multiple client
instances.

Previously, `CreateClient` would always return the same client instance,
making it impossible to connect to multiple, distinct provisioning
servers from a single application. The singleton implementation also
had a potential race condition in the `CreateClient` call.

This change introduces the following:

- The `ate_dll.cc` no longer uses a static client. Each call to
  `CreateClient` now returns a new, independent client instance.
- Callers are now responsible for managing the lifecycle of each client
  and must call `DestroyClient` for every instance created.
- The documentation in `ate_api.h` and `ate.md` has been updated to
  reflect the new factory pattern, and a guide has been added for
  managing multiple client instances.

Signed-off-by: Miguel Osorio <miguelosorio@google.com>
@moidx moidx requested a review from timothytrippel June 24, 2025 01:52
@moidx moidx merged commit 828c04c into lowRISC:main Jun 24, 2025
3 of 4 checks passed
@moidx moidx deleted the ate-client-no-load-balancing branch June 24, 2025 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants