source: buchla-68k/orig/MT/MTZAP.C@ 0170798

Last change on this file since 0170798 was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Imported original source code.

  • Property mode set to 100755
File size: 1.6 KB
RevLine 
[3ae31e9]1/*
2 =============================================================================
3 mtzap.c -- Multi-Tasker -- free a TCB
4 Version 3 -- 1988-04-14 -- D.N. Lynx Crowe
5 (c) Copyright 1988 -- D.N. Lynx Crowe
6 =============================================================================
7*/
8
9#include "stddefs.h"
10#include "biosdefs.h"
11#include "mtdefs.h"
12#include "debug.h"
13
14extern short setipl(); /* set processor IPL function */
15
16extern struct _mtdef *_MT_; /* Multi-Tasker structure pointer */
17
18/*
19
20*/
21
22/*
23 =============================================================================
24 MTZap() -- delete a task (free its TCB)
25
26 -1 not deleted (was active or waiting)
27 0 deleted
28 1 not found
29 =============================================================================
30*/
31
32short
33MTZap(tid)
34unsigned tid;
35{
36 register short oldipl, rv;
37 register TCB *tcp;
38
39 if ((struct _mt_def *)NIL EQ _MT_)
40 _MT_ = (struct _mt_def *)XBIOS(X_MTDEFS);
41
42 tcp = _MT_->mtp->TCBs; /* point at start of TCB table */
43 rv = 1; /* preset return code */
44
45 oldipl = setipl(7); /* DISABLE INTERRUPTS */
46
47 while (tcp) { /* check each TCB */
48
49 if (tcp->flags & MTF_OCC) { /* occupied ? */
50
51 if (tcp->tid NE tid) /* continue if not TCB we want */
52 goto nexttcb;
53
54 if (tcp->flags & ~MTF_OCC) { /* stopped ? */
55
56 rv = -1; /* not stopped */
57 break;
58 }
59
60 tcp->flags = 0; /* free the TCB */
61 rv = 0; /* TCB deleted */
62 break;
63 }
64
65nexttcb:
66 tcp = tcp->fwd; /* check next TCB */
67 }
68
69 setipl(oldipl); /* RESTORE INTERRUPTS */
70
71 return(rv); /* return deletion status */
72}
Note: See TracBrowser for help on using the repository browser.