| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> delphi >> WIN32 xia DELPHI zhong de duo xian cheng 【 tong bu 2】( wu )

WIN32 xia DELPHI zhong de duo xian cheng 【 tong bu 2】( wu )

2006-12-10 06:53:47 编辑來源:互联网 评论
 
 
 
本文为【WIN32下DELPHI中的多线程【同步2】(五)】的拼音翻译版
  xian cheng tong bu 2
   shang yi wen zhong zeng jing jie shao le xian cheng tong bu de yi xie fang fa , qi shi wan cheng tong bu huan you hen duo hen duo de ban fa , zhe li zui hou jie shao yi zhong fang shi -- xin hao liang nei gai dui xiang 。 bing jie ci lai hui gu xian cheng tong bu 。
   zai tan lun xin hao liang zhi qian , wo xiang xian tan lun ling wai yi zhong fang shi , yi zhong ni zui hao bu yao shi yong de fang shi 。 jia she ni you yi ge gong gong nei cun qu yu , ni bu xi wang yi ge xian cheng zai wan cheng yi ge cao zuo zhi qian ling wai yi ge xian cheng dui ta jin xing ling wai de cao zuo 。 pao kai qian mian suo you de zhi shi , wo men ke yi shi yong zhe yang yi zhong ban fa , yi zhong suo you ren dou hui xiang dao de ban fa 。
   cheng xu zhong she zhi yi ge bu er lei xing de gong gong bian liang FLAG, ci gong gong bian liang wei yi de zui yong shi jue ding xian cheng shi fou shi fou ke yi cao zuo gong gong nei cun qu yu 。 ru guo shi TRUE ze yuan xu cao zuo , ru guo shi FALSE ze jin zhi cao zuo 。 zai xian cheng jiang yao zhi xing dui gong xiang nei cun de cao zuo shi , fan fu pan duan ci bian liang , lei si yi ge si xun huan , zhi dao FLAG bian wei TRUE。 si lu hen jian dan , shi xian qi lai ye bi qian mian jie shao de na xie fang fa geng rong yi , zai mou zhong yi yi shang shuo , ta ye shi you xiao de 。 dan wen zhang qian mian zeng jing shuo guo , zui hao bu yong shi yong zhe zhong fang shi , wei shen me ? hui gu xian cheng de gong zuo zhuang tai , wo men ji ben ke yi zhe yang hua fen ,
  1、 chu yu ke tiao du zhuang tai ( gua qi ), ci zhuang tai xia de xian cheng zheng zai deng dai CPU fen pei shi jian pian gei ta lai zhi xing zi ji de cao zuo
  2、 deng dai zhuang tai , ci shi de xian cheng wo men ke yi cheng ta chu zai bu ke tiao du zhuang tai ,CPU jue bu hui zai deng dai shi jian wei fa sheng zhi qian fen pei shi jian pian gei ta , li ru yi ge xian cheng zheng zai deng dai mou jian shi qing de fa sheng , jiu bi ru qian bian shuo de deng dai shi jian nei gai dui xiang de zhuang tai bian wei yi tong zhi
  3、CPU yi fen pei shi jian pian gei xian cheng , ta zheng zai zhi xing zi ji de cao zuo 。
   jia ru wo men shi yong shi jian nei gai dui xiang lai wan cheng yi xie xian cheng de tong bu , na me qian mian zeng jing shuo guo , dang deng dai han shu jian ce dao shi jian nei gai dui xiang de zhuang tai wei wei tong zhi zhuang tai shi , ci xian cheng jiang chu yu deng dai zhuang tai , ci shi xian cheng bu hui shi yong CPU, er ru guo shi yong qian mian jie shao de na zhong fan fu pan duan bian liang de fang fa , na me ci xian cheng jiang zhan yong CPU zi yuan , zhe hen chong yao , wo shi zhong ren wei , dui yu yi ge he ge de cheng xu yuan er yan , jue dui bu yao wu wei de lang fei ke hu de CPU zi yuan 。
   sui ran wo shuo shang mian na zhong xun huan pan duan gong gong zhuang tai wei de ban fa bu ke qu , dan ta que fan yang le xian cheng tong bu de si xiang , ji shi wo men tiao yong na xie yong yu tong bu de API han shu , shi shi shang , tong bu de si xiang ye shi ru ci , zhi shi shi xian de fang fa bu tong er yi 。
  xin hao liang
   xin hao liang nei gai dui xiang yong yu dui zi yuan jin xing ji shu 。 ta men yu suo you nei gai dui xiang yi yang , bao han yi ge shi yong shu liang , dan shi ta men ye bao han ling wai liang ge dai fu hao de 32 wei zhi , yi ge shi zui da zi yuan shu liang , yi ge shi dang qian zi yuan shu liang 。 zui da zi yuan shu liang yong yu biao shi xin biao neng gou kong zhi de zi yuan de zui da shu liang , er dang qian zi yuan shu liang ze yong yu biao shi dang qian ke yi shi yong de zi yuan de shu liang 。
   xin hao liang de shi yong gui ze ru xia :
   • ru guo dang qian zi yuan de shu liang da yu 0, ze fa chu xin biao xin hao 。
   • ru guo dang qian zi yuan shu liang shi 0, ze bu fa chu xin biao xin hao 。
   • xi tong jue bu yuan xu dang qian zi yuan de shu liang wei fu zhi 。
   • dang qian zi yuan shu liang jue bu neng da yu zui da zi yuan shu liang 。
  chuang jian yi ge xin hao liang nei gai dui xiang
  HANDLE CreateSemaphore(
   LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, // pointer to security attributes
   LONG lInitialCount, // initial count
   LONG lMaximumCount, // maximum count
   LPCTSTR lpName // pointer to semaphore-object name
   );
   he da duo shu chuang jian nei gai dui xiang de han shu yi yang , ta de di yi ge shen shu yong lai jie shou an quan xin xi , tong chang wo men yong NULL lai biao shi mo ren , zui hou yi ge shen shu wei chuang jian zhe ge xin hao liang de ming zi , ci ming zi ke yi shi de wo men zai qi ta de jin cheng zhong shi yong ci xin hao liang ,lInitialCount shen shu dai biao chuang jian xin hao liang shi yuan xu zi yuan fang wen de ge shu ,lMaximumCount yong lai zhi ding zui da zi yuan shu , bu yao rang lInitialCount da yu lMaximumCount。
   shi yong Create*** chuang jian nei gai dui xiang shi , yao zhu yi yi ge wen ti , li ru , ru guo yi jing you yi ge jin cheng A chuang jian le yi ge ming wei 'wudi_1982' de xin hao liang nei gai dui xiang , dang ling wai yi ge jin cheng B ye shi tu chuang jian ming zi wei 'wudi_1982' de nei gai dui xiang de shi hou , xi tong shou xian yao cha kan shi fou yi jing cun zai yi ge ming zi wei 'wudi_1982' de nei gai dui xiang 。 you yu que shi cun zai yi ge dai you gai ming zi de dui xiang , yin ci nei gai yao jian cha dui xiang de lei xing 。 ru guo lei xing xiang tong ( li ru dou shi xin hao liang nei gai dui xiang ), ci shi xi tong hui zhi xing yi ci an quan jian cha , yi que ding tiao yong zhe shi fou yong you dui gai dui xiang de wan zheng de fang wen quan 。 ru guo yong you zhe zhong fang wen quan , xi tong jiu zai jin cheng B de ju bing biao zhong zhao chu yi ge kong xiang mu , bing dui gai xiang mu jin xing chu shi hua , shi gai xiang mu zhi xiang xian you de nei gai dui xiang 。 ru guo gai dui xiang lei xing bu pi pei , huo zhe tiao yong zhe bei ju jue fang wen , na me Create**** jiang yun xing shi bai ( fan hui NULL)。
  da kai yi ge xian you de xin hao liang
  HANDLE OpenSemaphore(
   DWORD dwDesiredAccess, // access flag
   BOOL bInheritHandle, // inherit flag
   LPCTSTR lpName // pointer to semaphore-object name
   );
   shen shu dwDesiredAccess dai biao le fang wen quan xian ,bInheritHandle shen shu biao ming zi jin cheng shi fou ke ji cheng , zui hou yi ge shen shu lpName yong yu zhi ming nei gai dui xiang de ming zi 。 bu neng wei gai shen shu chuan di NULL, bi xu chuan di yi 0 jie yi de di zhi 。 zhe xie han shu yao sou suo nei gai dui xiang de dan ge ming kong jian , yi bian zhao chu pi pei de kong jian 。 ru guo bu cun zai dai you zhi ding ming zi de nei gai dui xiang , gai han shu fan hui NULL,GetLastError fan hui 2(ERROR_FILE_NOT_FOUND)。 dan shi , ru guo cun zai dai you zhi ding ming zi de nei gai dui xiang , bing qie ta shi xiang tong lei xing de dui xiang , na me xi tong jiu yao cha kan shi fou yuan xu zhi xing suo xu de fang wen ( tong guo dwDesiredAccess shen shu jin xing fang wen )。 ru guo yong you gai fang wen quan , tiao yong jin cheng de ju bing biao jiu bei geng xin , dui xiang de shi yong ji shu bei di zeng 。 ru guo wei bInheritHandle, shen shu chuan di TRUE, na me fan hui de ju bing jiang shi ke ji cheng de 。 tiao yong Create* han shu yu tiao yong Open* han shu zhi jian de zhu yao cha bie shi , ru guo dui xiang bing bu cun zai , na me Create* han shu jiang chuang jian gai dui xiang , er Open* han shu ze yun xing shi bai 。
  tong guo tiao yong ReleaseSemaphore han shu , xian cheng jiu neng gou dui xin biao de dang qian zi yuan shu liang jin xing di zeng
  BOOL ReleaseSemaphore(
   HANDLE hSemaphore, // handle of the semaphore object
   LONG lReleaseCount, // amount to add to current count
   LPLONG lpPreviousCount // address of previous count
   );
   shen shu hSemaphore dai biao le yao cao zuo nei gai dui xiang de ju bing ,lReleaseCount biao ming gai han shu ci zhi tian jia gei xin biao de dang qian zi yuan shu liang , tong chang wo men yong 1。lpPreviousCount fan hui dang qian zi yuan shu liang de yuan shi zhi , da duo shu de shi hou wo men bing bu guan xin zhe ge shu zhi , suo yi yi ban fu zhi wei NULL。
  yi ge li zi :
WIN32下DELPHI中的多线程【同步2】(五)
WIN32下DELPHI中的多线程【同步2】(五)
...{
WIN32下DELPHI中的多线程【同步2】(五)
zuo zhe :wudi_1982
WIN32下DELPHI中的多线程【同步2】(五)
lian xi fang shi :wudi_1982@hotmail.com
WIN32下DELPHI中的多线程【同步2】(五)
ci dai ma yong lai yan shi shi yong xin hao liang wan cheng xian cheng de tong bu
WIN32下DELPHI中的多线程【同步2】(五)
zhuan zai qing zhu ming chu chu
WIN32下DELPHI中的多线程【同步2】(五)
}
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
// zhu yao dai ma
WIN32下DELPHI中的多线程【同步2】(五)
const
WIN32下DELPHI中的多线程【同步2】(五)
SEMANAME='MySema';// xin hao liang de ming zi
WIN32下DELPHI中的多线程【同步2】(五)
// xian cheng lei sheng ming
WIN32下DELPHI中的多线程【同步2】(五)
TSemaThread=class(TThread)
WIN32下DELPHI中的多线程【同步2】(五)
private
WIN32下DELPHI中的多线程【同步2】(五)
CurCount : integer;// dang qian ji shu
WIN32下DELPHI中的多线程【同步2】(五)
Flabel : TLabel;// yi ge yong lai zai jie mian shang xian shi dang qian ji shu de label
WIN32下DELPHI中的多线程【同步2】(五)
procedure GetRestult;
WIN32下DELPHI中的多线程【同步2】(五)
protected
WIN32下DELPHI中的多线程【同步2】(五)
procedure Execute;override;
WIN32下DELPHI中的多线程【同步2】(五)
public
WIN32下DELPHI中的多线程【同步2】(五)
constructor Create(Alabel : TLabel);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
// xian cheng lei de shi xian dai ma
WIN32下DELPHI中的多线程【同步2】(五)
constructor TSemaThread.Create(Alabel: TLabel);
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
Flabel := Alabel;
WIN32下DELPHI中的多线程【同步2】(五)
inherited Create(False);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
procedure TSemaThread.Execute;
WIN32下DELPHI中的多线程【同步2】(五)
// zhu yi xia mian zhe ge chang liang de ding yi
WIN32下DELPHI中的多线程【同步2】(五)
const
WIN32下DELPHI中的多线程【同步2】(五)
SEMAPHORE_ALL_ACCESS=$1F0003;
WIN32下DELPHI中的多线程【同步2】(五)
var
WIN32下DELPHI中的多线程【同步2】(五)
i : integer;
WIN32下DELPHI中的多线程【同步2】(五)
SmHandle : THandle;
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
inherited;
WIN32下DELPHI中的多线程【同步2】(五)
CurCount := 0;
WIN32下DELPHI中的多线程【同步2】(五)
SmHandle := OpenSemaphore(SEMAPHORE_ALL_ACCESS,false,SEMANAME);
WIN32下DELPHI中的多线程【同步2】(五)
WaitForSingleObject(SmHandle,INFINITE);
WIN32下DELPHI中的多线程【同步2】(五)
for i := 0 to 10000 do
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
Inc(CurCount);
WIN32下DELPHI中的多线程【同步2】(五)
GetRestult;
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)
ReleaseSemaphore(SmHandle,1,nil);
WIN32下DELPHI中的多线程【同步2】(五)
CloseHandle(SmHandle);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
// tiao yong ci ce shi lei de dai ma
WIN32下DELPHI中的多线程【同步2】(五)
procedure TSemaThread.GetRestult;
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
Flabel.Caption := IntToStr(CurCount);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
procedure TForm1.createTsClick(Sender: TObject);
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
TSemaThread.Create(labSem);
WIN32下DELPHI中的多线程【同步2】(五)
TSemaThread.Create(labSem2);
WIN32下DELPHI中的多线程【同步2】(五)
TSemaThread.Create(labSem3);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
procedure TForm1.CreateSemClick(Sender: TObject);
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
SmeHandle :=
WIN32下DELPHI中的多线程【同步2】(五)
CreateSemaphore(nil,1,3,SEMANAME);
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)
procedure TForm1.Button13Click(Sender: TObject);
WIN32下DELPHI中的多线程【同步2】(五)
begin
WIN32下DELPHI中的多线程【同步2】(五)
CloseHandle(SmeHandle)
WIN32下DELPHI中的多线程【同步2】(五)
end;
WIN32下DELPHI中的多线程【同步2】(五)

WIN32下DELPHI中的多线程【同步2】(五)

   dui shang shu li zi cao zuo de shuo ming :
   shou xian cheng xu tong guo yi ge an niu lai sheng cheng yi ge xin hao liang nei gai dui xiang , dang qian shi yong ji shu shi 1, zui da wei 3, zhe li , ru guo ni you xing qu , ni ke yi jiang dang qian shi yong ji shu gai wei 2, cong er ni ke yi guan cha dao xin hao liang nei gai dui xiang he qi ta nei gai dui xiang ( li ru hu chi ) de zui da qu bie 。 dang xin hao liang yi jing sheng cheng zhi hou , dian ji an niu chuang jian san ge xian cheng , xian cheng gen ju xin hao liang de ming zi tong guo OpenSemaphore lai da kai , zhe yang zuo de yi ge hao chu shi , ni ke yi tong shi duo ci zhi xing ci cheng xu , li ru ni jiang zhe ge cheng xu tong shi da kai le 3 ge , zai qi zhong yi ge zhong , shou xian she zhi xin hao liang , ran hou rang qi ta de cheng xu dou zhi xing xian cheng cao zuo , ni hui fa xian , ta men yi ran tong bu de hen hao 。 zhe shi lin jie qu wu fa zuo dao de 。
   dui dai ma de yi xie shuo ming :
  1、 duo ge jin cheng zhi jian lai wan cheng tong bu 。 zai qian mian de li zi zhong , wo dou shi shi yong yi ge quan jun bian liang ***:Thandle lai ji lu nei gai dui xiang , yi shi de wo men ke yi zai duo ge xian cheng zhong fang wen tong yi ge nei gai dui xiang , zhe li , wo mei you zai shi yong zhe ge ban fa , er shi li yong le ming zi , zhi suo yi yao zhe me zuo , shi yin wei , ru guo ni gei nei gai dui xiang qi yi ge ming zi , na me ni ke yi fang bian de zai qi ta xian cheng zhong shi yong tong yi ge nei gai dui xiang 。 zhe ye shi shi yong nei gai dui xiang wan cheng tong bu he shi yong lin jie qu fang shi zui da de bu tong , shi yong lin jie qu , ni zhi neng zai tong yi ge jin cheng zhong lai wan cheng tong bu 。 ni wan cheng ke yi jiang shang shu dai ma zheng li zhi hou zuo cheng yi ge cheng xu , ran hou tong shi zhi xing duo ge ci cheng xu , lai guan cha xiao guo 。 ji shi bu zai tong yi ge jin cheng zhi zhong , xian cheng yi ran ke yi hen hao de wan cheng tong bu 。
  2、Access Mask Format. zai li yong ming zi shi yong nei gai dui xiang shi , wo men yong dao OpenSemaphore lai wan cheng cao zuo , qian mian shuo le , ta de di yi ge shen shu yong lai jue ding fang wen quan xian , shi shi shang , qi ta de nei gai dui xiang , li ru hu chi , ta men de open* cao zuo dou shi ru ci 。 zhe ge yong lai jue ding quan xian de shen shu zhi guan chong yao , zai shang mian de dai ma zhong , wo ding yi le yi ge chang liang const SEMAPHORE_ALL_ACCESS=$1F0003;, ru guo ni zai DLEPHI zhong shi yong guo hu chi dui xiang lai wan cheng tong bu , ni hui jiao de bu ke li jie , yin wei zai shi OpenMutex han shu da kai hu chi dui xiang shi , di yi ge shen shu ni ke yi zhi jie shi yong MUTEX_ALL_ACCESS, na shi yin wei DELPHI de windows dan yuan zhong cun zai dui ta de ding yi , kan MSDN de bang zhu wen dang , ni hui fa xian shi yong xin hao liang shi hou , ye you yi ge lei si de yi jing ding yi de chang liang SEMAPHORE_ALL_ACCESS , bu guo hen ke xi ,DELPHI zhong bing mei you ding yi zhe ge chang liang , suo yi wo men bu de bu zi ji ding yi 。 ling wai zhi de zhu yi de yi dian shi , tong chang qing kuang xia , wo men dou shi shi yong $1F0003, dan you shi hou ni bu de bu shi yong qi ta de quan xian xin xi , ci shi , ni bi xu zhu yi de yi dian shi , ni yao rang quan xian zhong bao han SEMAPHORE_MODIFY_STATE(0x0002) zhe ge xin xi , zai MSDN zhong , ta de shuo ming ru xia ,Modify state access, which is required for the ReleaseSemaphore function. ni ke yi zuo jiang wo shang mian de dai ma jin xing jian dan xiu lai lai ce shi , li ru ni jiang SEMAPHORE_ALL_ACCESS ding yi wei STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE, na me zai cheng xu zhi xing de shi hou , ni hui fa xian zhi you di yi ge huo de CPU tiao du de xian cheng ke yi zheng chang wan cheng cao zuo , er qi ta deng dai ci xin hao liang de xian cheng jiang yong yuan de deng dai xia qu , yuan yin hen jian dan , jiu shi gang cai tie chu de MSDN shang de na yi ju hua 。 gen ju na yi ju hua , ru guo ni jiang SEMAPHORE_ALL_ACCESS ding yi wei $1F0002, ni hui fa xian , cheng xu ye mei you wen ti 。 wei shen me , zhe jiu yao shuo dao OpenSemaphore de dwDesiredAccess shen shu , na me ni jiu yao le jie Access Mask Format, ke yi gen ju xia mian de tu lai jia shen li jie 。 ju ti shen kao MSDN de bang zhu
WIN32下DELPHI中的多线程【同步2】(五)

  3、 nei gai dui xiang de shi yong ji shu 。 zai xian cheng de zhi xing dai ma zhong , ni ke yi kan dao zai xian cheng gong zuo wan cheng zhi hou de CloseHandle(SmHandle) zhe yi ju , qing ji zhu , ji shi shi fang bu bi yao de zi yuan , shi yi ge hen hao de xi guan 。 ci shi , ni ke neng hui wen , wo de di yi ge xian cheng tiao yong le CloseHandle(SmHandle), na me wo hou bian huan mei you zhi xing de xian cheng tong yang xu yao zhe ge zi yuan , shi fou jiu bu neng zhi xing le ne ? da an shi fou ding de 。 nei gai dui xiang bao han le yi ge shi yong ji shu xin xi , dang ni Create* de shi hou , shi yong ji shu shi 1, sui hou , dang open* de shi hou , shi yong ji shu jia 1。 dang ni tiao yong le yi ge CloseHandle shi , zai CloseHandle fan hui zhi qian , ta hui qing chu jin cheng de ju bing biao zhong de xiang mu , gai ju bing xian zai dui ni de jin cheng yi jing wu xiao , bu ying gai shi tu shi yong ta 。 wu lun nei gai dui xiang shi fou yi jing che xiao , dou hui fa sheng qing chu cao zuo 。 dang tiao yong CloseHandle han shu zhi hou , jiang bu zai yong you dui nei gai dui xiang de fang wen quan , bu guo , ru guo gai dui xiang de shi yong ji shu mei you di jian wei 0, na me gai dui xiang shang wei bei che xiao 。 zhe mei you wen ti , ta zhi shi yi wei zhe yi ge huo duo ge qi ta jin cheng zheng zai shi yong gai dui xiang 。 dang qi ta jin cheng ting zhi shi yong gai dui xiang shi ( tong guo tiao yong CloseHandle), gai dui xiang jiang bei che xiao 。
  yi xie ke yi yong yu tong bu de qi ta nei gai dui xiang
   hu chi dui xiang
   CreateMutex、ReleaseMutex、openMutex
   deng dai ji shi qi dui xiang
   CreateWaitableTimer、SetWaitableTimer
   zhuan zai qing zhu ming chu chu , xie xie !【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
xian cheng tong bu 2 shang yi wen zhong zeng jing jie shao le xian cheng tong bu de yi xie fang fa , qi shi wan cheng tong bu huan you hen duo hen duo de ban fa , zhe li zui hou jie shao yi zhong fang shi -- xin hao liang nei gai dui xiang 。 bing jie ci lai hui gu xian cheng tong bu 。 zai tan lun xin hao liang zhi qian , wo xiang xian tan lun ling wai yi zhong fang shi , yi zhong ni zui hao bu yao shi yong de fang shi 。 jia she ni you yi ge gong gong nei cun qu yu , ni bu xi wang yi ge xian cheng zai wan cheng yi ge cao zuo zhi qian ling wai yi ge xian cheng dui ta jin xing ling wai de cao zuo 。 pao kai qian mian suo you de zhi shi , wo men ke yi shi yong zhe yang yi zhong ban fa , yi zhong suo you ren dou hui xiang dao de ban fa 。 cheng xu zhong she zhi yi ge bu er lei xing de gong gong bian liang FLAG, ci gong gong bian liang wei yi de zui yong shi jue ding xian cheng shi fou shi fou ke yi cao zuo gong gong nei cun qu yu 。 ru guo shi TRUE ze yuan xu cao zuo , ru guo shi FALSE ze jin zhi cao zuo 。 zai xian cheng jiang yao zhi xing dui gong xiang nei cun de cao zuo shi , fan fu pan duan ci bian liang , lei si yi ge si xun huan , zhi dao FLAG bian wei TRUE。 si lu hen jian dan , shi xian qi lai ye bi qian mian jie shao de na xie fang fa geng rong yi , zai mou zhong yi yi shang shuo , ta ye shi you xiao de 。 dan wen zhang qian mian zeng jing shuo guo , zui hao bu yong shi yong zhe zhong fang shi , wei shen me ? hui gu xian cheng de gong zuo zhuang tai , wo men ji ben ke yi zhe yang hua fen , 1、 chu yu ke tiao du zhuang tai ( gua qi ), ci zhuang tai xia de xian cheng zheng zai deng dai CPU fen pei shi jian pian gei ta lai zhi xing zi ji de cao zuo 2、 deng dai zhuang tai , ci shi de xian cheng wo men ke yi cheng ta chu zai bu ke tiao du zhuang tai ,CPU jue bu hui zai deng dai shi jian wei fa sheng zhi qian fen pei shi jian pian gei ta , li ru yi ge xian cheng zheng zai deng dai mou jian shi qing de fa sheng , jiu bi ru qian bian shuo de deng dai shi jian nei gai dui xiang de zhuang tai bian wei yi tong zhi 3、CPU yi fen pei shi jian pian gei xian cheng , ta zheng zai zhi xing zi ji de cao zuo 。 jia ru wo men shi yong shi jian nei gai dui xiang lai wan cheng yi xie xian cheng de tong bu , na me qian mian zeng jing shuo guo , dang deng dai han shu jian ce dao shi jian nei gai dui xiang de zhuang tai wei wei tong zhi zhuang tai shi , ci xian cheng jiang chu yu deng dai zhuang tai , ci shi xian cheng bu hui shi yong CPU, er ru guo shi yong qian mian jie shao de na zhong fan fu pan duan bian liang de fang fa , na me ci xian cheng jiang zhan yong CPU zi yuan , zhe hen chong yao , wo shi zhong ren wei , dui yu yi ge he ge de cheng xu yuan er yan , jue dui bu yao wu wei de lang fei ke hu de CPU zi yuan 。 sui ran wo shuo shang mian na zhong xun huan pan duan gong gong zhuang tai wei de ban fa bu ke qu , dan ta que fan yang le xian cheng tong bu de si xiang , ji shi wo men tiao yong na xie yong yu tong bu de API han shu , shi shi shang , tong bu de si xiang ye shi ru ci , zhi shi shi xian de fang fa bu tong er yi 。 xin hao liang xin hao liang nei gai dui xiang yong yu dui zi yuan jin xing ji shu 。 ta men yu suo you nei gai dui xiang yi yang , bao han yi ge shi yong shu liang , dan shi ta men ye bao han ling wai liang ge dai fu hao de 32 wei zhi , yi ge shi zui da zi yuan shu liang , yi ge shi dang qian zi yuan shu liang 。 zui da zi yuan shu liang yong yu biao shi xin biao neng gou kong zhi de zi yuan de zui da shu liang , er dang qian zi yuan shu liang ze yong yu biao shi dang qian ke yi shi yong de zi yuan de shu liang 。 xin hao liang de shi yong gui ze ru xia : • ru guo dang qian zi yuan de shu liang da yu 0, ze fa chu xin biao xin hao 。 • ru guo dang qian zi yuan shu liang shi 0, ze bu fa chu xin biao xin hao 。 • xi tong jue bu yuan xu dang qian zi yuan de shu liang wei fu zhi 。 • dang qian zi yuan shu liang jue bu neng da yu zui da zi yuan shu liang 。 chuang jian yi ge xin hao liang nei gai dui xiang HANDLE CreateSemaphore( LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, // pointer to security attributes LONG lInitialCount, // initial count LONG lMaximumCount, // maximum count LPCTSTR lpName // pointer to semaphore-object name ); he da duo shu chuang jian nei gai dui xiang de han shu yi yang , ta de di yi ge shen shu yong lai jie shou an quan xin xi , tong chang wo men yong NULL lai biao shi mo ren , zui hou yi ge shen shu wei chuang jian zhe ge xin hao liang de ming zi , ci ming zi ke yi shi de wo men zai qi ta de jin cheng zhong shi yong ci xin hao liang ,lInitialCount shen shu dai biao chuang jian xin hao liang shi yuan xu zi yuan fang wen de ge shu ,lMaximumCount yong lai zhi ding zui da zi yuan shu , bu yao rang lInitialCount da yu lMaximumCount。 shi yong Create*** chuang jian nei gai dui xiang shi , yao zhu yi yi ge wen ti , li ru , ru guo yi jing you yi ge jin cheng A chuang jian le yi ge ming wei 'wudi_1982' de xin hao liang nei gai dui xiang , dang ling wai yi ge jin cheng B ye shi tu chuang jian ming zi wei 'wudi_1982' de nei gai dui xiang de shi hou , xi tong shou xian yao cha kan shi fou yi jing cun zai yi ge ming zi wei 'wudi_1982' de nei gai dui xiang 。 you yu que shi cun zai yi ge dai you gai ming zi de dui xiang , yin ci nei gai yao jian cha dui xiang de lei xing 。 ru guo lei xing xiang tong ( li ru dou shi xin hao liang nei gai dui xiang ), ci shi xi tong hui zhi xing yi ci an quan jian cha , yi que ding tiao yong zhe shi fou yong you dui gai dui xiang de wan zheng de fang wen quan 。 ru guo yong you zhe zhong fang wen quan , xi tong jiu zai jin cheng B de ju bing biao zhong zhao chu yi ge kong xiang mu , bing dui gai xiang mu jin xing chu shi hua , shi gai xiang mu zhi xiang xian you de nei gai dui xiang 。 ru guo gai dui xiang lei xing bu pi pei , huo zhe tiao yong zhe bei ju jue fang wen , na me Create**** jiang yun xing shi bai ( fan hui NULL)。 da kai yi ge xian you de xin hao liang HANDLE OpenSemaphore( DWORD dwDesiredAccess, // access flag BOOL bInheritHandle, // inherit flag LPCTSTR lpName // pointer to semaphore-object name ); shen shu dwDesiredAccess dai biao le fang wen quan xian ,bInheritHandle shen shu biao ming zi jin cheng shi fou ke ji cheng , zui hou yi ge shen shu lpName yong yu zhi ming nei gai dui xiang de ming zi 。 bu neng wei gai shen shu chuan di NULL, bi xu chuan di yi 0 jie yi de di zhi 。 zhe xie han shu yao sou suo nei gai dui xiang de dan ge ming kong jian , yi bian zhao chu pi pei de kong jian 。 ru guo bu cun zai dai you zhi ding ming zi de nei gai dui xiang , gai han shu fan hui NULL,GetLastError fan hui 2(ERROR_FILE_NOT_FOUND)。 dan shi , ru guo cun zai dai you zhi ding ming zi de nei gai dui xiang , bing qie ta shi xiang tong lei xing de dui xiang , na me xi tong jiu yao cha kan shi fou yuan xu zhi xing suo xu de fang wen ( tong guo dwDesiredAccess shen shu jin xing fang wen )。 ru guo yong you gai fang wen quan , tiao yong jin cheng de ju bing biao jiu bei geng xin , dui xiang de shi yong ji shu bei di zeng 。 ru guo wei bInheritHandle, shen shu chuan di TRUE, na me fan hui de ju bing jiang shi ke ji cheng de 。 tiao yong Create* han shu yu tiao yong Open* han shu zhi jian de zhu yao cha bie shi , ru guo dui xiang bing bu cun zai , na me Create* han shu jiang chuang jian gai dui xiang , er Open* han shu ze yun xing shi bai 。 tong guo tiao yong ReleaseSemaphore han shu , xian cheng jiu neng gou dui xin biao de dang qian zi yuan shu liang jin xing di zeng BOOL ReleaseSemaphore( HANDLE hSemaphore, // handle of the semaphore object LONG lReleaseCount, // amount to add to current count LPLONG lpPreviousCount // address of previous count ); shen shu hSemaphore dai biao le yao cao zuo nei gai dui xiang de ju bing ,lReleaseCount biao ming gai han shu ci zhi tian jia gei xin biao de dang qian zi yuan shu liang , tong chang wo men yong 1。lpPreviousCount fan hui dang qian zi yuan shu liang de yuan shi zhi , da duo shu de shi hou wo men bing bu guan xin zhe ge shu zhi , suo yi yi ban fu zhi wei NULL。 yi ge li zi : [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif[/img][/url][url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif[/img][/url]...{ [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif[/img][/url] zuo zhe :wudi_1982 [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif[/img][/url] lian xi fang shi :wudi_1982@hotmail.com [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif[/img][/url] ci dai ma yong lai yan shi shi yong xin hao liang wan cheng xian cheng de tong bu [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif[/img][/url] zhuan zai qing zhu ming chu chu [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif[/img][/url]} [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]// zhu yao dai ma [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]const [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] SEMANAME='MySema';// xin hao liang de ming zi [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] // xian cheng lei sheng ming [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] TSemaThread=class(TThread) [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] private [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] CurCount : integer;// dang qian ji shu [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] Flabel : TLabel;// yi ge yong lai zai jie mian shang xian shi dang qian ji shu de label [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] procedure GetRestult; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] protected [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] procedure Execute;override; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] public [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] constructor Create(Alabel : TLabel); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]// xian cheng lei de shi xian dai ma [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]constructor TSemaThread.Create(Alabel: TLabel); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] Flabel := Alabel; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] inherited Create(False); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]procedure TSemaThread.Execute; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]// zhu yi xia mian zhe ge chang liang de ding yi [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]const [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] SEMAPHORE_ALL_ACCESS=$1F0003; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]var [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] i : integer; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] SmHandle : THandle; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] inherited; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] CurCount := 0; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] SmHandle := OpenSemaphore(SEMAPHORE_ALL_ACCESS,false,SEMANAME); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] WaitForSingleObject(SmHandle,INFINITE); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] for i := 0 to 10000 do [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] Inc(CurCount); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] GetRestult; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] ReleaseSemaphore(SmHandle,1,nil); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] CloseHandle(SmHandle); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]// tiao yong ci ce shi lei de dai ma [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]procedure TSemaThread.GetRestult; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] Flabel.Caption := IntToStr(CurCount); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]procedure TForm1.createTsClick(Sender: TObject); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] TSemaThread.Create(labSem); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] TSemaThread.Create(labSem2); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] TSemaThread.Create(labSem3); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]procedure TForm1.CreateSemClick(Sender: TObject); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] SmeHandle := [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] CreateSemaphore(nil,1,3,SEMANAME); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]procedure TForm1.Button13Click(Sender: TObject); [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]begin [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] CloseHandle(SmeHandle) [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url]end; [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif[/img][/url] dui shang shu li zi cao zuo de shuo ming : shou xian cheng xu tong guo yi ge an niu lai sheng cheng yi ge xin hao liang nei gai dui xiang , dang qian shi yong ji shu shi 1, zui da wei 3, zhe li , ru guo ni you xing qu , ni ke yi jiang dang qian shi yong ji shu gai wei 2, cong er ni ke yi guan cha dao xin hao liang nei gai dui xiang he qi ta nei gai dui xiang ( li ru hu chi ) de zui da qu bie 。 dang xin hao liang yi jing sheng cheng zhi hou , dian ji an niu chuang jian san ge xian cheng , xian cheng gen ju xin hao liang de ming zi tong guo OpenSemaphore lai da kai , zhe yang zuo de yi ge hao chu shi , ni ke yi tong shi duo ci zhi xing ci cheng xu , li ru ni jiang zhe ge cheng xu tong shi da kai le 3 ge , zai qi zhong yi ge zhong , shou xian she zhi xin hao liang , ran hou rang qi ta de cheng xu dou zhi xing xian cheng cao zuo , ni hui fa xian , ta men yi ran tong bu de hen hao 。 zhe shi lin jie qu wu fa zuo dao de 。 dui dai ma de yi xie shuo ming : 1、 duo ge jin cheng zhi jian lai wan cheng tong bu 。 zai qian mian de li zi zhong , wo dou shi shi yong yi ge quan jun bian liang ***:Thandle lai ji lu nei gai dui xiang , yi shi de wo men ke yi zai duo ge xian cheng zhong fang wen tong yi ge nei gai dui xiang , zhe li , wo mei you zai shi yong zhe ge ban fa , er shi li yong le ming zi , zhi suo yi yao zhe me zuo , shi yin wei , ru guo ni gei nei gai dui xiang qi yi ge ming zi , na me ni ke yi fang bian de zai qi ta xian cheng zhong shi yong tong yi ge nei gai dui xiang 。 zhe ye shi shi yong nei gai dui xiang wan cheng tong bu he shi yong lin jie qu fang shi zui da de bu tong , shi yong lin jie qu , ni zhi neng zai tong yi ge jin cheng zhong lai wan cheng tong bu 。 ni wan cheng ke yi jiang shang shu dai ma zheng li zhi hou zuo cheng yi ge cheng xu , ran hou tong shi zhi xing duo ge ci cheng xu , lai guan cha xiao guo 。 ji shi bu zai tong yi ge jin cheng zhi zhong , xian cheng yi ran ke yi hen hao de wan cheng tong bu 。 2、Access Mask Format. zai li yong ming zi shi yong nei gai dui xiang shi , wo men yong dao OpenSemaphore lai wan cheng cao zuo , qian mian shuo le , ta de di yi ge shen shu yong lai jue ding fang wen quan xian , shi shi shang , qi ta de nei gai dui xiang , li ru hu chi , ta men de open* cao zuo dou shi ru ci 。 zhe ge yong lai jue ding quan xian de shen shu zhi guan chong yao , zai shang mian de dai ma zhong , wo ding yi le yi ge chang liang const SEMAPHORE_ALL_ACCESS=$1F0003;, ru guo ni zai DLEPHI zhong shi yong guo hu chi dui xiang lai wan cheng tong bu , ni hui jiao de bu ke li jie , yin wei zai shi OpenMutex han shu da kai hu chi dui xiang shi , di yi ge shen shu ni ke yi zhi jie shi yong MUTEX_ALL_ACCESS, na shi yin wei DELPHI de windows dan yuan zhong cun zai dui ta de ding yi , kan MSDN de bang zhu wen dang , ni hui fa xian shi yong xin hao liang shi hou , ye you yi ge lei si de yi jing ding yi de chang liang SEMAPHORE_ALL_ACCESS , bu guo hen ke xi ,DELPHI zhong bing mei you ding yi zhe ge chang liang , suo yi wo men bu de bu zi ji ding yi 。 ling wai zhi de zhu yi de yi dian shi , tong chang qing kuang xia , wo men dou shi shi yong $1F0003, dan you shi hou ni bu de bu shi yong qi ta de quan xian xin xi , ci shi , ni bi xu zhu yi de yi dian shi , ni yao rang quan xian zhong bao han SEMAPHORE_MODIFY_STATE(0x0002) zhe ge xin xi , zai MSDN zhong , ta de shuo ming ru xia ,Modify state access, which is required for the ReleaseSemaphore function. ni ke yi zuo jiang wo shang mian de dai ma jin xing jian dan xiu lai lai ce shi , li ru ni jiang SEMAPHORE_ALL_ACCESS ding yi wei STANDARD_RIGHTS_REQUIRED or SYNCHRONIZE, na me zai cheng xu zhi xing de shi hou , ni hui fa xian zhi you di yi ge huo de CPU tiao du de xian cheng ke yi zheng chang wan cheng cao zuo , er qi ta deng dai ci xin hao liang de xian cheng jiang yong yuan de deng dai xia qu , yuan yin hen jian dan , jiu shi gang cai tie chu de MSDN shang de na yi ju hua 。 gen ju na yi ju hua , ru guo ni jiang SEMAPHORE_ALL_ACCESS ding yi wei $1F0002, ni hui fa xian , cheng xu ye mei you wen ti 。 wei shen me , zhe jiu yao shuo dao OpenSemaphore de dwDesiredAccess shen shu , na me ni jiu yao le jie Access Mask Format, ke yi gen ju xia mian de tu lai jia shen li jie 。 ju ti shen kao MSDN de bang zhu [url=http://www.wangchao.net.cn/bbs/pydetail_565954.html][img]http://p.blog.csdn.net/images/p_blog_csdn_net/wudi_1982/accctrl4.gif[/img][/url] 3、 nei gai dui xiang de shi yong ji shu 。 zai xian cheng de zhi xing dai ma zhong , ni ke yi kan dao zai xian cheng gong zuo wan cheng zhi hou de CloseHandle(SmHandle) zhe yi ju , qing ji zhu , ji shi shi fang bu bi yao de zi yuan , shi yi ge hen hao de xi guan 。 ci shi , ni ke neng hui wen , wo de di yi ge xian cheng tiao yong le CloseHandle(SmHandle), na me wo hou bian huan mei you zhi xing de xian cheng tong yang xu yao zhe ge zi yuan , shi fou jiu bu neng zhi xing le ne ? da an shi fou ding de 。 nei gai dui xiang bao han le yi ge shi yong ji shu xin xi , dang ni Create* de shi hou , shi yong ji shu shi 1, sui hou , dang open* de shi hou , shi yong ji shu jia 1。 dang ni tiao yong le yi ge CloseHandle shi , zai CloseHandle fan hui zhi qian , ta hui qing chu jin cheng de ju bing biao zhong de xiang mu , gai ju bing xian zai dui ni de jin cheng yi jing wu xiao , bu ying gai shi tu shi yong ta 。 wu lun nei gai dui xiang shi fou yi jing che xiao , dou hui fa sheng qing chu cao zuo 。 dang tiao yong CloseHandle han shu zhi hou , jiang bu zai yong you dui nei gai dui xiang de fang wen quan , bu guo , ru guo gai dui xiang de shi yong ji shu mei you di jian wei 0, na me gai dui xiang shang wei bei che xiao 。 zhe mei you wen ti , ta zhi shi yi wei zhe yi ge huo duo ge qi ta jin cheng zheng zai shi yong gai dui xiang 。 dang qi ta jin cheng ting zhi shi yong gai dui xiang shi ( tong guo tiao yong CloseHandle), gai dui xiang jiang bei che xiao 。 yi xie ke yi yong yu tong bu de qi ta nei gai dui xiang hu chi dui xiang CreateMutex、ReleaseMutex、openMutex deng dai ji shi qi dui xiang CreateWaitableTimer、SetWaitableTimer zhuan zai qing zhu ming chu chu , xie xie !
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
桌球宝贝_性感在蔓延(3)
桌球宝贝_性感在蔓延(2)
银杏树下清纯女孩(9)
银杏树下清纯女孩(8)
痞子的甘南日记
疑是银河落九天
雪域坝上四——纯美色
冬日恋歌——西城杨柳弄轻柔
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有