?? task.cc
字號:
/***************************************************************************
*
* Copyright (c) 1993 READY SYSTEMS CORPORATION.
*
* All rights reserved. READY SYSTEMS' source code is an unpublished
* work and the use of a copyright notice does not imply otherwise.
* This source code contains confidential, trade secret material of
* READY SYSTEMS. Any attempt or participation in deciphering, decoding,
* reverse engineering or in any way altering the source code is
* strictly prohibited, unless the prior written consent of
* READY SYSTEMS is obtained.
*
*
* Module Name: task.cc
*
* Identification: @(#) 1.12 task.cc
*
* Date: 2/22/94 14:43:16
*
****************************************************************************
*/
#include "task.h"
Task::Task (void (*entry_point) (), int priority, int id)
{
int err;
if (id == -1)
tid = sc_tcreate (entry_point, id, priority, &err);
else {
sc_tcreate (entry_point, id, priority, &err);
tid = id;
}
}
Task::~Task ()
{
int err;
if (tid != 0)
sc_tdelete (tid, 0, &err);
}
void
Task::suspend ()
{
int err;
if (tid != 0)
sc_tsuspend (tid, 0, &err);
}
void
Task::resume ()
{
int err;
if (tid != 0)
sc_tsuspend (tid, 0, &err);
}
void
Task::delay (unsigned long ticks)
{
sc_delay(ticks);
}
void
Task::delay (struct timespec seconds)
{
int err;
sc_adelay(seconds, &err);
}
void
Task::exit ()
{
int err;
sc_tdelete (0, 0, &err);
}
void
Task::yield ()
{
sc_delay(0);
}
int
Task::id ()
{
return tid;
}
TCB *
Task::tcb ()
{
int err, info[3];
if (tid != 0)
return sc_tinquiry (info, tid, &err);
else
return (TCB *) 0;
}
int
Task::priority ()
{
int err, info[3];
if (tid != 0) {
(void) sc_tinquiry (info, tid, &err);
return info[1];
} else
return 0;
}
int
Task::status ()
{
int err, info[3];
if (tid != 0) {
(void) sc_tinquiry (info, tid, &err);
return info[2];
} else
return 0;
}
void
Task::set_priority (int priority)
{
int err;
if (tid != 0)
sc_tpriority (tid, priority, &err);
}
int
Task::this_id ()
{
int err, info[3];
(void) sc_tinquiry (info, 0, &err);
return info[0];
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -