📄 atdelctx.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel / Standard Extension * * Copyright (C) 2006 by Ken Sakamura. All rights reserved. * T-Kernel / Standard Extension is distributed * under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * * Version: 1.00.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* * atdelctx.c (libtkse) * * Discard the task context * * The processing within library when task context is unnecessary * such as the task exit time, etc. */#include <tk/tkernel.h>#include <sys/libs.h>LOCAL void atdelctx_exec( ID tskid );IMPORT FP __atdelctx_entry; /* delctx.c */#define NENT 8#define TSD_ADC_RTN_M1 (-1)LOCAL void (*delctx_func[NENT])( ID tskid );/* * Execute the processing function when task context is discarded. */LOCAL void atdelctx_exec( ID tskid ){ W i; for ( i = NENT - 1; i >= 0; --i ) { if ( delctx_func[i] != NULL ) { (*delctx_func[i])(tskid); } }}/* * Register the processing when task context is discarded. */EXPORT int __atdelctx( void (*func)( ID tskid ) ){ W i; (void)_lib_lock(_LL_MISC, TRUE); for ( i = 0; i < NENT; ++i ) { if ( delctx_func[i] == NULL ) { delctx_func[i] = func; __atdelctx_entry = atdelctx_exec; break; } } _lib_unlock(_LL_MISC); return ( i < NENT )? 0: TSD_ADC_RTN_M1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -