[openrtm-commit:02619] r2996 - trunk/OpenRTM-aist/src/lib/coil/vxworks/coil
openrtm @ openrtm.org
openrtm @ openrtm.org
2017年 5月 31日 (水) 11:13:29 JST
Author: miyamoto
Date: 2017-05-31 11:13:29 +0900 (Wed, 31 May 2017)
New Revision: 2996
Modified:
trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.cpp
trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.h
Log:
[incompat, VxWorks] Modified Task.cpp.
Modified: trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.cpp 2017-05-30 09:56:31 UTC (rev 2995)
+++ trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.cpp 2017-05-31 02:13:29 UTC (rev 2996)
@@ -18,6 +18,11 @@
#include <coil/Task.h>
+#ifdef __RTP__
+#define DEFAULT_PRIORITY 110
+#define DEFAULT_STACKSIZE 60000
+#endif
+
namespace coil
{
@@ -30,8 +35,15 @@
*/
Task::Task()
: m_count(0)
+#ifdef __RTP__
+ ,m_priority(DEFAULT_PRIORITY)
+ ,m_stacksize(DEFAULT_STACKSIZE)
+#endif
{
+#ifdef __RTP__
+#else
::pthread_attr_init(&m_attr);
+#endif
}
/*!
@@ -93,10 +105,22 @@
{
if (m_count == 0)
{
+#ifdef __RTP__
+ m_tid = taskSpawn(
+ 0,
+ m_priority,
+ VX_FP_TASK | VX_NO_STACK_FILL,
+ m_stacksize,
+ (FUNCPTR)Task::svc_run,
+ (int)this,
+ 0,0,0,0,0,0,0,0,0
+ );
+#else
::pthread_create(&m_thread,
&m_attr,
(void* (*)(void*))Task::svc_run,
this);
+#endif
++m_count;
};
}
@@ -112,8 +136,12 @@
{
if (m_count > 0)
{
+#ifdef __RTP__
+ taskExit(m_tid);
+#else
void* retval;
::pthread_join(m_thread, &retval);
+#endif
}
return 0;
}
@@ -173,7 +201,11 @@
* @brief Start thread Execution
* @endif
*/
+#ifdef __RTP__
+ extern "C" void* Task::svc_run(void* args)
+#else
void* Task::svc_run(void* args)
+#endif
{
Task* t = (coil::Task*)args;
int status;
@@ -181,6 +213,52 @@
t->finalize();
return 0;
}
+
+
+#ifdef __RTP__
+ /*!
+ * @if jp
+ *
+ * @brief ¥¿¥¹¥¯¤ÎÍ¥ÀèÅÙ¤òÀßÄê
+ *
+ *
+ * @param priority Í¥ÀèÅÙ
+ *
+ * @else
+ *
+ * @brief
+ *
+ *
+ * @param priority
+ *
+ * @endif
+ */
+ void Task::set_priority(int priority)
+ {
+ m_priority = priority;
+ }
+ /*!
+ * @if jp
+ *
+ * @brief ¥¹¥¿¥Ã¥¯¥µ¥¤¥º¤ÎÀßÄê
+ *
+ *
+ * @param stacksize ¥¹¥¿¥Ã¥¯¥µ¥¤¥º
+ *
+ * @else
+ *
+ * @brief
+ *
+ *
+ * @param stacksize
+ *
+ * @endif
+ */
+ void Task::set_stacksize(int stacksize)
+ {
+ m_stacksize = stacksize;
+ }
+#endif
};
Modified: trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.h 2017-05-30 09:56:31 UTC (rev 2995)
+++ trunk/OpenRTM-aist/src/lib/coil/vxworks/coil/Task.h 2017-05-31 02:13:29 UTC (rev 2996)
@@ -19,7 +19,12 @@
#ifndef COIL_TASK_H
#define COIL_TASK_H
+#ifdef __RTP__
+#include <vxWorks.h>
+#include <taskLib.h>
+#else
#include <pthread.h>
+#endif
namespace coil
{
@@ -255,13 +260,59 @@
*/
static void* svc_run(void* args = 0);
+#ifdef __RTP__
+ /*!
+ * @if jp
+ *
+ * @brief ¥¿¥¹¥¯¤ÎÍ¥ÀèÅÙ¤òÀßÄê
+ *
+ *
+ * @param priority Í¥ÀèÅÙ
+ *
+ * @else
+ *
+ * @brief
+ *
+ *
+ * @param priority
+ *
+ * @endif
+ */
+ void set_priority(int priority);
+ /*!
+ * @if jp
+ *
+ * @brief ¥¹¥¿¥Ã¥¯¥µ¥¤¥º¤ÎÀßÄê
+ *
+ *
+ * @param stacksize ¥¹¥¿¥Ã¥¯¥µ¥¤¥º
+ *
+ * @else
+ *
+ * @brief
+ *
+ *
+ * @param stacksize
+ *
+ * @endif
+ */
+ void set_stacksize(int stacksize);
+#endif
+
private:
int m_count;
+#ifdef __RTP__
+ int m_tid;
+ int m_priority;
+ int m_stacksize;
+#else
pthread_t m_thread;
pthread_attr_t m_attr;
+#endif
void* m_args;
};
+
};
#endif // COIL_TASK_H
More information about the openrtm-commit
mailing list