?? dllist-driver.cc
字號:
#include <cstdio>#include <cstdlib>#include <ctime>#include "system.h"#include "dllist.h"DLList L;void Begin(int n ){ void * temp; int key, i; srand( time(0) ); for( i = 1; i <= Node_num; i++ ) { temp = new int( rand() ) ; temp = ( void * )( (int)temp % 10000 ); key = (int)temp % 1000; //L.SortedInsert( temp, key ); printf("Thread %d: Inssert:%d, Item:%d\n", n, key, (int)temp ); L.SortedInsert( temp, key ); if( Flag == 1 ) {//&& rand() % 2 == 0 printf("\tBegin interrupt!\n"); currentThread->Yield(); } }}void End( int n ){ int key; void * temp; int i=0; while( !L.IsEmpty()&& i!=Node_num ) { if( ( temp = L.Remove(& key ) ) ) printf("Thread %d: Removed:%d, Item:%d\n", n, key, (int)temp ); i++; if( Flag == 2 ) { printf("End interrupt!\n"); currentThread->Yield(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -