📄 test_loop.c
字号:
/*************************************************************************** loop_test.c - Tests the loop ------------------- begin : date authors : name emails : e-mail ***************************************************************************//*************************************************************************** Changes ------- date - name - description 03/02/14 - ineiti - begin 04/03/03 - ineiti - added short description **************************************************************************//*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/char desc[] ="Description:\n""Tests the loop that has been in the subsystem and that should be gone\n""now. Any error-message from the subsystem should be taken very\n""seriously...\n";#include "spc.h"#include "std.h"#define DBG_LVL 4struct chain_t *test_chain;void *start_it( void *arg ) { swr_sdb_id loop; int i; loop = swr_sdb_instantiate_name( "loop" ); swr_conn_add( loop, 0, loop, 1 ); swr_conn_add( loop, 1, loop, 0 ); swr_sdb_set_config_int( loop, "size", 100 ); for ( i=0; i<10; i++ ) { PR( "Sending message-#: %i\n", i ); swr_sdb_send_msg( loop, SUBS_MSG_USER, NULL, -1 ); } swr_sdb_destroy( loop ); return 0;}swr_spc_id_t spm_id;struct thread start;/** * This function is called upon "insmod" and is used to register the * different parts of the module to the SPM. */int um_module_init(void) { PR_CL( desc ); test_chain = NULL; if ( swr_thread_init( &start, start_it, NULL ) < 0 ) goto first_no_stack; return 0;first_no_stack: PR_DBG( 0, "Couldn't allocate stack\n" ); return -1;}void um_module_exit( void ) { swr_thread_free( &start, NULL ); swr_chain_destroy( test_chain );}module_init( um_module_init );module_exit( um_module_exit );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -