mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
sched: simplify call of get current tcb
Replace get current tcb method from nxsched_get_tcb(nxsched_gettid()) to this_task(), change two function calls with inline function to improve performance: FAR struct tcb_s *tcb = nxsched_get_tcb(nxsched_gettid()); FAR struct tcb_s *tcb = this_task(); Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
@@ -86,7 +86,7 @@ int nx_vsyslog(int priority, FAR const IPTR char *fmt, FAR va_list *ap)
|
||||
struct lib_syslograwstream_s stream;
|
||||
int ret = 0;
|
||||
#ifdef CONFIG_SYSLOG_PROCESS_NAME
|
||||
FAR struct tcb_s *tcb = nxsched_get_tcb(nxsched_gettid());
|
||||
FAR struct tcb_s *tcb = nxsched_self();
|
||||
#endif
|
||||
#ifdef CONFIG_SYSLOG_TIMESTAMP
|
||||
struct timespec ts;
|
||||
|
||||
@@ -111,12 +111,15 @@ int nxsched_set_scheduler(pid_t pid, int policy,
|
||||
|
||||
if (pid == 0)
|
||||
{
|
||||
pid = nxsched_gettid();
|
||||
tcb = this_task();
|
||||
}
|
||||
else
|
||||
{
|
||||
tcb = nxsched_get_tcb(pid);
|
||||
}
|
||||
|
||||
/* Verify that the pid corresponds to a real task */
|
||||
|
||||
tcb = nxsched_get_tcb(pid);
|
||||
if (!tcb)
|
||||
{
|
||||
return -ESRCH;
|
||||
|
||||
Reference in New Issue
Block a user