Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
TEST18.C
Package: ertos.rar [view]
Upload User: sunrenlu
Upload Date: 2022-06-13
Package Size: 1419k
Code Size: 1k
Category:
OS Develop
Development Platform:
DOS
- #include <stdio.h>
- #include <rtos.h>
- #include <conio.h>
- /*
- * Demonstrate buffer overrun detection
- */
- #if defined(__TURBOC__) || defined(__BORLANDC__)
- #define STACKLEN 2048
- #else
- #define STACKLEN 4096
- #endif
- /*********************************************************/
- void test(DWORD arg)
- {
- char *p;
- #define TESTSIZE 512
- p = kcalloc( TESTSIZE, 1 );
- if ( p != NULL ) {
- memset( p, 0, TESTSIZE + 1 );
- kfree( p );
- }
- }
- /*********************************************************/
- int main(int argc, char **argv)
- {
- int i;
- // changing the next line would all that is needed to make this
- // a pre-emptive multithreaded application
- kpreemptive = 0;
- kdebug = 1;
- rt_init(100);
- kwindow( 1, 6, 80, 16 );
- cputs("Will demonstrate capturing a buffer overrunrn");
- cputs("starting...rn");
- rt_newthread( test, 1,4096, 0, "worker 1" );
- for ( i = 0 ; i < 1000 ; ++i ) {
- rt_sleep( 10 );
- cprintf("in main %inr", i);
- }
- }