PropWare  3.0.0.229
C++ objects and CMake build system for Parallax Propeller
cogend.c
1 /*
2  * @file cogend.c
3  *
4  * @author Andy Lindsay
5  *
6  * @copyright
7  * Copyright (C) Parallax, Inc. 2014. All Rights MIT Licensed.
8  *
9  * @brief Source code for cog_end function.
10  */
11 
12 
13 #include "simpletools.h"
14 
15 void cog_end(int *coginfo)
16 {
17  int cog = *coginfo - 1;
18  if(cog > -1)
19  {
20  if(cog == cogid())
21  {
22  free(coginfo);
23  cogstop(cog);
24  }
25  else
26  {
27  cogstop(cog);
28  free(coginfo);
29  }
30  }
31  *coginfo = 0;
32 }
33 
34 
simpletools.h
This library provides convenient functions for a variety of microcontroller I/O, timing,...
cog_end
void cog_end(int *coginfo)
End function code running in another cog that was launched with cog_run.
Definition: cogend.c:15
cogstop
#define cogstop(a)
Stop a COG.
Definition: propeller.h:100
cogid
#define cogid()
Return the id of the current cog.
Definition: propeller.h:76