Skip to content

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

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

Merged
merged 1 commit into from
Jun 24, 2025

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 <[email protected]>
@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