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

It seems that System would be locked or doesn't work properly when Mutex cannot get due to PlatformMutex_Lock doesn't have return value #156

Closed
KeitaKashima opened this issue Nov 1, 2023 · 3 comments

Comments

@KeitaKashima
Copy link

Hi, I wonder the system would be locked or not work properly if PlatformMutex_Lock API cannot get Mutex or happened the timeout of Mutex.

PlatformMutex_Lock( &pContext->PktRespMutex );

    PlatformMutex_Lock( &pContext->PktRespMutex );    // It gets the Mutex however, the API doesn't have return value. So, the code cannot check timeout.
    pContext->cbEvents.networkRegistrationCallback = networkRegistrationCallback;
    pContext->cbEvents.pNetworkRegistrationCallbackContext = pCallbackContext;
    PlatformMutex_Unlock( &pContext->PktRespMutex );

Does it nerver happnened?

@shubnil
Copy link
Member

shubnil commented Nov 2, 2023

HI @KeitaKashima ,
Thanks for bringing this up. We have not observed this.
Do you have a use case where you are seeing this behavior

@KeitaKashima
Copy link
Author

Hi @shubnil ,

Thank you for your reply.
I have never seen the lock of the system here. I just checked the implementation of the Semaphore portion.

@chinglee-iot
Copy link
Member

Hi @KeitaKashima,
The PktRespMutex is used to protect the cellular context which can be accessed by the pktio thread and the application thread. The code with the mutex held should not block indefinitely, and no timeout is expected with the mutex lock operation. You can reference the example implementation in this file.

@n9wxu n9wxu closed this as completed May 16, 2024
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

No branches or pull requests

4 participants