Explorar el Código

rt_thread_set_suspend_state改为static

shaojinchun hace 5 años
padre
commit
b5194a2273
Se han modificado 3 ficheros con 25 adiciones y 31 borrados
  1. 1 1
      include/rtdef.h
  2. 0 1
      include/rtthread.h
  3. 24 29
      src/thread.c

+ 1 - 1
include/rtdef.h

@@ -517,7 +517,7 @@ typedef siginfo_t rt_siginfo_t;
 #define RT_THREAD_RUNNING                    0x03                /**< Running status */
 
 /*
- * for rt_thread_set_suspend_state()
+ * for rt_thread_suspend_with_flag()
  */
 enum
 {

+ 0 - 1
include/rtthread.h

@@ -147,7 +147,6 @@ rt_err_t rt_thread_delay(rt_tick_t tick);
 rt_err_t rt_thread_delay_until(rt_tick_t *tick, rt_tick_t inc_tick);
 rt_err_t rt_thread_mdelay(rt_int32_t ms);
 rt_err_t rt_thread_control(rt_thread_t thread, int cmd, void *arg);
-void rt_thread_set_suspend_state(struct rt_thread *thread, int suspend_flag);
 rt_err_t rt_thread_suspend(rt_thread_t thread);
 rt_err_t rt_thread_suspend_with_flag(rt_thread_t thread, int suspend_flag);
 rt_err_t rt_thread_resume(rt_thread_t thread);

+ 24 - 29
src/thread.c

@@ -506,35 +506,6 @@ rt_err_t rt_thread_yield(void)
 }
 RTM_EXPORT(rt_thread_yield);
 
-/**
- * This function will set a thread's suspend status
- *
- * @param thread the thread to be suspend
- * @param status flag of the thread, must be one of RT_INTERRUPTIBLE RT_KILLABLE RT_UNINTERRUPTIBLE
- */
-void rt_thread_set_suspend_state(struct rt_thread *thread, int suspend_flag)
-{
-    rt_uint8_t stat = RT_THREAD_SUSPEND_UNINTERRUPTIBLE;
-
-    RT_ASSERT(thread != RT_NULL);
-    switch (suspend_flag)
-    {
-    case RT_INTERRUPTIBLE:
-        stat = RT_THREAD_SUSPEND_INTERRUPTIBLE;
-        break;
-    case RT_KILLABLE:
-        stat = RT_THREAD_SUSPEND_KILLABLE;
-        break;
-    case RT_UNINTERRUPTIBLE:
-        stat = RT_THREAD_SUSPEND_UNINTERRUPTIBLE;
-        break;
-    default:
-        RT_ASSERT(0);
-        break;
-    }
-    thread->stat = stat | (thread->stat & ~RT_THREAD_STAT_MASK);
-}
-
 /**
  * This function will let current thread sleep for some ticks.
  *
@@ -770,6 +741,30 @@ RTM_EXPORT(rt_thread_control);
 #ifdef RT_USING_LWP
 int lwp_suspend_sigcheck(rt_thread_t thread, int suspend_flag);
 #endif
+
+static void rt_thread_set_suspend_state(struct rt_thread *thread, int suspend_flag)
+{
+    rt_uint8_t stat = RT_THREAD_SUSPEND_UNINTERRUPTIBLE;
+
+    RT_ASSERT(thread != RT_NULL);
+    switch (suspend_flag)
+    {
+    case RT_INTERRUPTIBLE:
+        stat = RT_THREAD_SUSPEND_INTERRUPTIBLE;
+        break;
+    case RT_KILLABLE:
+        stat = RT_THREAD_SUSPEND_KILLABLE;
+        break;
+    case RT_UNINTERRUPTIBLE:
+        stat = RT_THREAD_SUSPEND_UNINTERRUPTIBLE;
+        break;
+    default:
+        RT_ASSERT(0);
+        break;
+    }
+    thread->stat = stat | (thread->stat & ~RT_THREAD_STAT_MASK);
+}
+
 /**
  * This function will suspend the specified thread.
  *