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

adding support for pthread_mutex_lock handling #641

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sona78
Copy link

@sona78 sona78 commented May 5, 2024

Updates:

  • Standardized pthread_mutex_lock handling with replacement with interruptible locks for error handling
  • Updated proc_loadavg.c with more robust handling to unlock mutexes that will cause errors

@@ -138,7 +138,10 @@ static void insert_node(struct load_node **n, int locate)
{
struct load_node *f;

pthread_mutex_lock(&load_hash[locate].lock);

if(mutex_lock_interruptible(&load_hash[locate].lock)){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the purpose replacing of a non-interruptible mutex with interruptible in this case?

Also, if you doing that, you need to handle "interrupt" case very-very carefully in all places from where the surrounding function (insert_node) is called.

pthread_mutex_lock(&load_hash[locate].lock);

if(mutex_lock_interruptible(&load_hash[locate].lock)){
return NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function has a void return type. Have you tried to compile and test this code?

@mihalicyn
Copy link
Member

a few things to consider:

  • this code does not compile
  • there is not Signed-off-by tag in the commit message
  • please, explain a reason for this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants