linux系統(tǒng)課程-課件09day09線程同步_第1頁
linux系統(tǒng)課程-課件09day09線程同步_第2頁
linux系統(tǒng)課程-課件09day09線程同步_第3頁
linux系統(tǒng)課程-課件09day09線程同步_第4頁
linux系統(tǒng)課程-課件09day09線程同步_第5頁
已閱讀5頁,還剩8頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

分區(qū)分區(qū)linux-day09-PAGE3 constpthread_rwlockattr_t*restrictattr);pthread_rwlock_trwlock=intintintint分區(qū)分區(qū)linux-day09-線程同步的第PAGE6 pthread_mutex_t*restrictmutex,structtimespec}

time_t /*seconds*/longtv_nsec;/*nanosecondes*tv_sectime(NULL)+600==>設置超時pthread_mutex_t*restrict先釋放鎖constpthread_condattr_t*restrictattr);分區(qū)分區(qū)linux-day09-8 創(chuàng)建線程回收線程線程退出pthread_exit殺死線程pthread_cancel線程分離pthread_detach,也可以通過屬性設置pthread_attr_setdetachstate設置屬性分離,之前需要查看線程IDpthread_self在進程內(nèi)唯一 intsem_init(sem_t*sem,intpshared,unsignedint0非0valueintsem_destroy(sem_t*sem);intsem_wait(sem_t*sem);釋放信號量value++intsem_post(sem_t分區(qū)linux-day09-9 分區(qū)linux-day09-10分區(qū)分區(qū)linux-day09-PAGE11 #defineEPERM 1/*Operationnotpermitted*/#defineENOENT 2/*Nosuchfileordirectory*/#defineESRCH 3/*Nosuchprocess*/#defineEINTR /*Interruptedsystemcall*/#defineEIO /*I/Oerror*/#defineENXIO /*Nosuchdeviceoraddress*/#defineE2BIG /*Argumentlisttoolong*/#defineENOEXEC /*Execformaterror*/#defineEBADF /*Badfilenumber*/#defineECHILD /*Nochildprocesses*/#defineEAGAIN /*Tryagain*/#defineENOMEM12/*Outofmemory*/#defineEACCES13/*Permissiondenied*/#defineEFAULT14/*Badaddress*/#defineENOTBLK15/*Blockdevicerequired*/#defineEBUSY 16/*Deviceorresourcebusy*/#defineEEXIST17/*Fileexists*/#defineEXDEV /*Cross-devicelink*/#defineENODEV /*Nosuchdevice*/#defineENOTDIR /*Notadirectory*/#defineEISDIR /*Isadirectory*/#defineEINVAL 22 /*Invalidargument*/#defineENFILE /*Filetableoverflow*/#defineEMFILE 24 /*Toomanyopenfiles*/#defineENOTTY /*Notatypewriter*/#defineETXTBSY /*Textfilebusy*/#defineEFBIG /*Filetoolarge*/#defineENOSPC /*Nospaceleftondevice*/#defineESPIPE /*Illegalseek*/#defineEROFS /*Read-onlyfilesystem*/#defineEMLINK /*Toomanylinks*/#define /*Brokenpipe#define /*Mathargumentoutofof#define /*Mathresultnotrepresentable#defineEDEADLK /*Resourcedeadlockwouldoccur*/#defineENALONG /*Filenametoolong*/#defineENOLCK /*Norecordlocksavailable*/#defineENOSYS /*Invalidsystemcallnumber*/#defineENOTEMPTY /*Directorynotempty*/#define /*Toomanysymboliclinks#defineEWOULDBLOCK EAGAIN/*Operationwouldblock*/#defineENOMSG /*Nomessageofdesiredtype*/#defineEIDRM /*Identifierremoved*/#defineECHRNG /*Channelnumberoutofrange*/#defineEL2NSYNC /*Level2notsynchronized*/#defineEL3HLT /*Level3halted*/#define /*Level3reset#defineELNRNG /*Linknumberoutofrange*/#defineEUNATCH /*Protocoldrivernotattached*/#defineENOCSI /*NoCSIstructureavailable*/#defineEL2HLT /*Level2halted*/#define /*Invalidexchange#defineEBADR 53 /*Invalidrequestdescriptor*/#defineEXFULL /*Exchangefull*/#define /*Noanode#defineEBADRQC /*Invalidrequestcode*/#defineEBADSLT /*Invalidslot*/#define #defineEBFONT /*Badfontfileformat*/#defineENOSTR /*Devicenotastream*/#defineENODATA /*Nodataavailable*/#defineETIME /*Timerexpired*/#define /*Outofstreamsresources#defineENONET /*Machineisnotonthenetwork*/#defineENOPKG 65 /*Packagenotinstalled*/#defineEREMOTE /*Objectisremote*/#defineENOLINK /*Linkhasbeensevered*/#defineEADV /*Advertiseerror*/#define /*Srmounterror#defineECOMM /*Communicationerroronsend*/#defineEPROTO /*Protocolerror*/#defineEMULTIHOP /*Multihopattempted*/#defineEDOTDOT /*RFSspecificerror*/#defineEBADMSG /*Notadatamessage*/#defineEOVERFLOW /*Valuetoolargefordefineddatatype*/#defineENOTUNIQ /*Namenotuniqueonnetwork*/#defineEBADFD /*Filedescriptorinbadstate*/#defineEREMCHG /*Remoteaddresschanged*/#define /*Cannotaccessaneededshared#defineELIBBAD /*Accessingacorruptedsharedlibrary*/ /*.libsectionina.outcorrupted*/#defineELIBMAX /*Attemptingtolinkintoomanysharedlibraries*/#define /*Cannotexecasharedlibrary#define /*Illegalbytesequence#defineERESTART /*Interruptedsystemcallshouldberestarted*/#defineESTRPIPE /*Streamspipeerror*/#defineEUSERS /*Toomanyusers*/#defineENOTSOCK88/*Socketoperationonnon-socket*/#defineEDESTADDRREQ89/*Destinationaddressrequired*/#defineEMSGSIZE90/*Messagetoolong*/#defineEPROTOTYPE /*Protocolwrongtypeforsocket*/#defineENOPROTOOPT /*Protocolnotavailable*/#defineEPROTONOSUPPORT93 /*Protocolnotsupported*/#defineESOCKTNOSUPPORT94 /*Sockettypenotsupported*/#defineEOPNOTSUPP /*Operationnotsupportedontransportendpoint*/#define /*Protocolfamilynotsupported#defineEAFNOSUPPORT /*Addressfamilynotsupportedbyprotocol*/#define /*Addressalreadyinuse#define /*Cannotassignrequested#define /*Networkisdown#defineENETUNREACH101/*Networkisunreachable*/#defineENETRESET102/*Networkdroppedconnectionbecauseofreset*/#defineECONNABORTED103/*Softwarecausedconnectionabort*/#define/*Connectionresetbypeer#define/*Nobufferspaceavailable#define/*Transportendpointisconnected#defineENOTCONN /*Transportendpointisnotconnected*/#defineESHUTDOWN /*Cannotsendaftertransportendpointshutdown*/#defineETOOMANYREFS /*Toomanyreferences:cannotsplice*/#defineETIMEDOUT /*Connectiontimedout*/#defineECONNREFUSED /*Connectionrefused*/#defineEHOSTDOWN /*Hostisdown*/#defineEHOSTUNREACH /*Noroutetohost*/#defineEALREADY /*Operationalreadyinprogress*/#defineEINPROGRESS /*Oper

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論