You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2017/11/09 18:23:11 UTC
[GitHub] mkiiskila closed pull request #654: kernel/os; remove OS_TASK_FLAG_LOCK_HELD
mkiiskila closed pull request #654: kernel/os; remove OS_TASK_FLAG_LOCK_HELD
URL: https://github.com/apache/mynewt-core/pull/654
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/kernel/os/include/os/os_task.h b/kernel/os/include/os/os_task.h
index 32e56f584..a9e420f5e 100644
--- a/kernel/os/include/os/os_task.h
+++ b/kernel/os/include/os/os_task.h
@@ -6,7 +6,7 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
@@ -21,7 +21,7 @@
#define _OS_TASK_H
#include "os/os.h"
-#include "os/os_sanity.h"
+#include "os/os_sanity.h"
#include "os/queue.h"
#ifdef __cplusplus
@@ -32,14 +32,13 @@ extern "C" {
#define OS_TASK_PRI_HIGHEST (0)
#define OS_TASK_PRI_LOWEST (0xff)
-/*
+/*
* Generic "object" structure. All objects that a task can wait on must
- * have a SLIST_HEAD(, os_task) head_name as the first element in the object
+ * have a SLIST_HEAD(, os_task) head_name as the first element in the object
* structure. The element 'head_name' can be any name. See os_mutex.h or
* os_sem.h for an example.
*/
-struct os_task_obj
-{
+struct os_task_obj {
SLIST_HEAD(, os_task) obj_head; /* chain of waiting tasks */
};
@@ -54,7 +53,6 @@ typedef enum os_task_state {
#define OS_TASK_FLAG_SEM_WAIT (0x02U)
#define OS_TASK_FLAG_MUTEX_WAIT (0x04U)
#define OS_TASK_FLAG_EVQ_WAIT (0x08U)
-#define OS_TASK_FLAG_LOCK_HELD (0x10U)
typedef void (*os_task_func_t)(void *);
@@ -119,10 +117,10 @@ struct os_task_info {
char oti_name[OS_TASK_MAX_NAME_LEN];
};
+
struct os_task *os_task_info_get_next(const struct os_task *,
struct os_task_info *);
-
#ifdef __cplusplus
}
#endif
diff --git a/kernel/os/src/os_mutex.c b/kernel/os/src/os_mutex.c
index 7a3d353d8..117045f97 100644
--- a/kernel/os/src/os_mutex.c
+++ b/kernel/os/src/os_mutex.c
@@ -125,11 +125,8 @@ os_mutex_release(struct os_mutex *mu)
mu->mu_owner = rdy;
if (rdy) {
rdy->t_lockcnt++;
- rdy->t_flags |= OS_TASK_FLAG_LOCK_HELD;
- }
- if (--current->t_lockcnt == 0) {
- current->t_flags &= ~OS_TASK_FLAG_LOCK_HELD;
}
+ --current->t_lockcnt;
/* Do we need to re-schedule? */
resched = 0;
@@ -191,7 +188,6 @@ os_mutex_pend(struct os_mutex *mu, uint32_t timeout)
mu->mu_owner = current;
mu->mu_prio = current->t_prio;
current->t_lockcnt++;
- current->t_flags |= OS_TASK_FLAG_LOCK_HELD;
mu->mu_level = 1;
OS_EXIT_CRITICAL(sr);
return OS_OK;
diff --git a/kernel/os/src/os_task.c b/kernel/os/src/os_task.c
index 06c23d2a8..10fceec4b 100644
--- a/kernel/os/src/os_task.c
+++ b/kernel/os/src/os_task.c
@@ -191,15 +191,9 @@ os_task_remove(struct os_task *t)
}
/*
- * Disallowing suspending tasks which are holding a lock
- * Checking lockcnt and flags separately so we can assert separately XXX
+ * Disallowing suspending tasks which are holding a mutex
*/
if (t->t_lockcnt) {
- assert(t->t_flags & OS_TASK_FLAG_LOCK_HELD);
- return OS_EBUSY;
- }
- if (t->t_flags & OS_TASK_FLAG_LOCK_HELD) {
- assert(t->t_lockcnt);
return OS_EBUSY;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services