马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 柏柏 于 2014-2-21 11:33 编辑 ;写a.txt文件用两个线程写
;API----------------------------------------------------------------------------------------
;WaitForSingleObject http://baike.baidu.com/view/908866.htm
;WritePrivateProfileSection http://baike.baidu.com/view/1295780.htm
;;Sleep
;CreateMutex http://baike.baidu.com/view/1285853.htm
;CreateThread http://baike.baidu.com/view/1191444.htm
;CloseHandle http://baike.baidu.com/view/1288756.htm
;--------------------------------------------------------------------------------------------
.386
.Model Flat, StdCall
Option Casemap :None
Include windows.inc
Include user32.inc
Include kernel32.inc
Include gdi32.inc
includelib gdi32.lib
IncludeLib user32.lib
IncludeLib kernel32.lib
include macro.asm
.data
file_name db '.\a.txt',0
file db 'FILE2011',0
a1 dd '1',0
a2 dd '2',0
ff dd ?
.code
CC1 proc ;线程1
.while TRUE
;----------------------------
invoke WaitForSingleObject,offset ff,INFINITE
invoke Sleep,1000
invoke WritePrivateProfileSection,addr file,addr a1,addr file_name
;invoke Sleep,1000
;----------------------------
.endw
ret
CC1 endp
CC2 proc ; ;线程2
.while TRUE
;----------------------------
;invoke Sleep,1000
invoke WaitForSingleObject,offset ff,INFINITE
invoke Sleep,1000
invoke WritePrivateProfileSection,addr file,addr a2,addr file_name
;----------------------------
.endw
ret
CC2 endp
start:
invoke CreateMutex,NULL,FALSE,NULL
mov ff,eax
;--------------------------------------
invoke CreateThread,0,0,offset CC1,0,0,0
|