Skip to content
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

[QUESTION] Using Arbitrated client with empty server for multithreaded client calls #374

Open
taldinj opened this issue Aug 18, 2023 · 4 comments
Labels
Milestone

Comments

@taldinj
Copy link

taldinj commented Aug 18, 2023

Hi,

Our use case is clinet->server only. So we have used the basic erpc_client_init().
As far as I can see this interface is not thread safe In terms if send receive synchronization (correct?)
I do see that ArbitratedClientManager() solves this with the pending client list . On the other hand ArbitratedClient seems intended for use with Server\Client sharing a transport and not for the our use case.
To force usage of arbitrated client I guess that would force me to create an DispatchServer and run a server thread soley for this Before I dive into this any furtert, I would like to seek advice:
Is using ArbitratedClient \server without any actual service (possible?) an overkill ?

Thanks

@Hadatko
Copy link
Member

Hadatko commented Aug 19, 2023

Hi @taldinj, if i understand corectly you want let several threads call client rpc functions. I see some ideas to improve current solution to match your requests, but can be tricky. Anyway currently you would have to setup arbitrator client and server on one side and server on other side. You don't need add services to server (i think so).

@Hadatko
Copy link
Member

Hadatko commented Aug 19, 2023

Actually i think you can simplyfy first side with using only arbitrator client (no server) and call arbitratedTransport->receive(MessageBuffer) in loop.
This is interesting and we can make more generic easy use abstraction for your use case and also fill it into documentation.

@taldinj
Copy link
Author

taldinj commented Aug 26, 2023

Hi,
Thank you for your replies. Sorry for my late response I was on an off the grip vacation for a long time.
Just to clerify you last suggestion, " using only arbitrator client (no server) and call arbitratedTransport->receive(MessageBuffer) in loop.", that would still have to be done with a thread that keeps this receive loop alive right?

Basically you are saying I can immitate what DispatchServer does in DispatchServer::runInternalBegin

    erpc_status_t err = kErpcStatus_Success;

    if (m_messageFactory->createServerBuffer() == true)
    {
        buff = m_messageFactory->create();
        if (NULL == buff.get())
        {
            err = kErpcStatus_MemoryError;
        }
    }

    /* Receive the next invocation request. */
    if (err == kErpcStatus_Success)
    {
        err = m_transport->receive(&buff);
    }

Did I understand you correctly?

@Hadatko
Copy link
Member

Hadatko commented Aug 26, 2023

No problem. Yes you are right. It has to be in its own thread. Yes your code snippet looks correct to me ;)

@Hadatko Hadatko added this to the 1.13.0 milestone Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants