You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2023/01/10 18:15:54 UTC

[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

xiaoxiang781216 opened a new pull request, #8074:
URL: https://github.com/apache/nuttx/pull/8074

   ## Summary
   
   and refine the code to prepare the support of new flags
   
   ## Impact
   
   code refactor only
   
   ## Testing
   
   Pass CI
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1066688914


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   Why not
   ```suggestion
     sem->flags &= ~SEM_PRIO_MASK;
     sem->flags = protocol & SEM_PRIO_MASK;
   ```
   ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1066826141


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   @pkarashchenko It intends to not mask protocol with SEM_PRIO_MASK, since the upcoming patch will add a new flag:
   ```
   #define SEM_USAGE_MUTEX 0x04
   ```
   and the caller(mutex) can change the usage from sem to mutex explicitly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1067133125


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   So mutex will be calling `set_protocol`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1067133125


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   So mutex will be calling `set_protocol` with `PRIO_MASK`+`MUTEX`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1067138489


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   Yes, it's called inside nxmutex_init, so it doesn't break the compatibility of user code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko merged pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
pkarashchenko merged PR #8074:
URL: https://github.com/apache/nuttx/pull/8074


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1066826141


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   @pkarashchenko It intends to not mask protocol with SEM_PRIO_MASK, since the upcoming patch will add a new flag:
   ```
   #define SEM_USAGE_MUTEX 0x04
   ```
   and the caller(mutex) will change the usage from sem to mutex explicitly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1066826141


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   It intends to not mask protocol with SEM_PRIO_MASK, since the upcoming patch will add a new flag:
   ```
   #define SEM_USAGE_MUTEX 0x04
   ```
   and the caller(mutex) can change the usage from sem to mutex explicitly.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] pkarashchenko commented on a diff in pull request #8074: sem: Remove PRIOINHERIT_FLAGS_ENABLE and use SEM_PRIO_INHERIT instead

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8074:
URL: https://github.com/apache/nuttx/pull/8074#discussion_r1067133125


##########
sched/semaphore/sem_setprotocol.c:
##########
@@ -103,10 +96,11 @@ int nxsem_set_protocol(FAR sem_t *sem, int protocol)
         return -ENOTSUP;
 
       default:
-        break;
+        return -EINVAL;
     }
 
-  return -EINVAL;
+  sem->flags = protocol;

Review Comment:
   So mutex will be calling `set_protocol` with one od `PRIO_MASK` values + `MUTEX`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org