锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久国产精品无,久久亚洲欧美日本精品,99久久久久http://www.shnenglu.com/byc/category/15470.htmlzh-cnMon, 15 Nov 2010 20:25:33 GMTMon, 15 Nov 2010 20:25:33 GMT60pthreads-w32http://www.shnenglu.com/byc/archive/2010/11/15/133666.html鍏彾鑽?/dc:creator>鍏彾鑽?/author>Mon, 15 Nov 2010 07:41:00 GMThttp://www.shnenglu.com/byc/archive/2010/11/15/133666.htmlhttp://www.shnenglu.com/byc/comments/133666.htmlhttp://www.shnenglu.com/byc/archive/2010/11/15/133666.html#Feedback0http://www.shnenglu.com/byc/comments/commentRss/133666.htmlhttp://www.shnenglu.com/byc/services/trackbacks/133666.htmlhttp://shenan1984.blog.163.com/blog/static/2530851020098231001787/
  official site: http://sourceware.org/pthreads-win32/
  source code: ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz

1. 緙栬瘧:
    铏界劧婧愮爜鍖呴噷鎻愪緵浜唙c6鐨勯」鐩枃浠? 浣嗘槸鎵撲笉寮鐨? 鍙兘鐢╪make. 榛樿鐨勪細鍛婅瘔浣犱竴鍫唍make鍙傛暟鐨?
    鎴戞墍瑕佺敤鐨勬槸緙栬瘧鎴恠tatic鐨刲ibrary, 鎵浠ヨ緭鍏?nmake clean VC-static", 緙栬瘧寰堝揩鐨? 涓嶈繃榛樿浼氶摼鎺ュ埌VC鐨刢rt, 鎴戜滑闇瑕佷慨鏀瑰畠鐨刴akefile. 鎵懼埌CFLAGS閭d竴琛? 鎶?/MD"鏀規垚"/MT".

2. 欏圭洰:
    璇?. 鏈夊ソ澶氬湴鏂硅鏀圭殑.
    a) 褰撶劧鏄痸s璺緞鐨刬nclude鍟? lib鍟?. 鑷繁鍔?
    b) 欏圭洰鐨刢rt璁劇疆鎴?/MT"鍜?/MTd". 棰濆鐨刲ib鍔? pthreadVC2(d).lib ws2_32.lib
    c) preprocesser瀹氫箟鐨勫湴鏂? 鍔犱竴涓?#8220;PTW32_STATIC_LIB”瀹? 涓嶇劧link鐨勬椂鍊欎細鎵句笉鍒皊ymbol鐨?
    d) 濂戒簡, 浣犲彲浠oding浜? 闅忎究pthread_create()涓鎶婂惂.

3. 緙栫爜:
    鍡棷.. 濡傛灉鐪熺殑鐩存帴pthread_create()鐨勮瘽鍙槸浼歛ccess violation鐨勫憖. win32涓嬬殑綰跨▼寰堣寮傜殑, 鍍弚insock涓鏍? 璋冪敤浠諱綍鍏跺畠鍑芥暟涔嬪墠蹇呴』璋冪敤pthread_win32_process_attach_np(), 緇撴潫鍚庡繀欏昏皟鐢╬thread_win32_process_detach_np(). 浠g爜澶ф灝辨槸榪欐牱鐨?

1. 涓嬭澆pthreads win32婧愪唬鐮侊細
    ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-8-0-release.tar.gz
2. 緙栬瘧闈欐佸簱錛?br>make clean GC-static
鍦ㄦ牴鐩綍涓嬮潰鐢熸垚libpthreadGC2.a
3. 灝嗙敓鎴愮殑libpthreadGC2.a鎷瘋礉鍒癿ingw搴撶洰褰曚笅錛屽皢pthread.h, sched.h, semaphore.h鎷瘋礉鍒癐NCLUDE鐩綍涓?br>4. 浣跨敤libpthread搴擄紝
鍦ㄧ▼搴忚搗濮嬪瀵筶ibpthread浣滃垵濮嬪寲錛?br>#if defined(PTW32_STATIC_LIB)
    ptw32_processInitialize();
#endif
5. 緙栬瘧鏃剁‘淇濅紶鍏?DPTW32_STATIC_LIB錛岄摼鎺ユ椂鍔犲叆-lpthreadGC2錛?OK錛?br>

http://hi.baidu.com/lff0305/blog/item/2a55e7366ebba6360b55a942.html
pthread2鎻愪緵浜嗕笉鍚岀殑.lib浠ュ強鐩稿搴旂殑.dll,

pthread[VG]{SE,CE,C}c.dll
pthread[VG]{SE,CE,C}c.lib

 

鍚箟涓?br>[VG] 緙栬瘧鍣ㄧ綾?br>V    - MS VC, or
G    - GNU C

 

{SE,CE,C} 寮傚父澶勭悊妯″紡
SE    - Structured EH, or
CE    - C++ EH, or
C    - no exceptions - uses setjmp/longjmp

c    - DLL compatibility number indicating ABI and API
compatibility with applications built against
any snapshot with the same compatibility number.
See 'Version numbering' below.

   姣斿涓婇潰鐢ㄧ殑pthreadvc2.dll, 鍚箟涓?

   v = MSVC

   c = 娌℃湁浣跨敤寮傚父鏈哄埗, 鑰屾槸浣跨敤setjump/longjmp

   2 = 鍏肩敤鎬?- 鍜宲thread2鍏煎, 涓嶅拰鏃х増鏈琾thread1鍏煎.

 

   璇︾粏璇峰弬鐓thread鐨剅eadme.


http://blog.csdn.net/psusong/archive/2010/01/14/5189659.aspx

pthread 闈欐佺紪璇戠増鏈湪Windows涓嬩嬌鐢ㄦ椂鐨勬敞鎰忎簨欏?
浣滀負閫氱敤鐨勮法騫沖彴楂樻ц兘綰跨▼搴擄紝鍦ㄥ緢澶氳法騫沖彴鐨勯」鐩腑閮藉彲浠ョ湅瑙乸thread鐨勮韓褰便俻thread鏈韓鐨勫疄鐜版瘮杈冧紭闆咃紝APIs浣跨敤璧鋒潵涔熷緢鏂逛究銆?/p>

浣嗗湪Windows涓嬩嬌鐢ㄩ潤鎬佺紪璇戠殑pthread鏃惰鐗瑰埆娉ㄦ剰涓涓嬶紝蹇呴』鏄懼紡鐨勮皟鐢ㄥ涓嬪洓涓嚱鏁幫紝鍚﹀垯pthread鐢ㄥ埌鐨勪竴浜涘叏灞鍙橀噺浼氭病鏈夎鍒濆鍖栵紝瀵艱嚧鎵鏈夌殑pthread鐨凙PIs璋冪敤閮絚rash.

BOOL pthread_win32_process_attach_np (void);

BOOL pthread_win32_process_detach_np (void);

BOOL pthread_win32_thread_attach_np (void);

BOOL pthread_win32_thread_detach_np (void);

pthread瀹樻柟鏂囨。瀵規鏈夊涓嬬殑鏄庣‘璇存槑錛?/p>

These functions contain the code normally run via dllMain

when the library is used as a dll but which need to be

called explicitly by an application when the library

is statically linked.

You will need to call pthread_win32_process_attach_np() before

you can call any pthread routines when statically linking.

You should call pthread_win32_process_detach_np() before

exiting your application to clean up.

pthread_win32_thread_attach_np() is currently a no-op, but

pthread_win32_thread_detach_np() is needed to clean up

the implicit pthread handle that is allocated to a Win32 thread if

it calls certain pthreads routines. Call this routine when the

Win32 thread exits.

These functions invariably return TRUE except for

pthread_win32_process_attach_np() which will return FALSE

if pthreads-win32 initialisation fails.

閫氳繃鍑芥暟鐨勫悕瀛楁垜浠笉闅劇寽嫻嬪嚭濡備笅璋冪敤欏哄簭

鍦ㄧ▼搴忓紑濮嬬殑鏃跺欒璋冪敤錛?/p>

BOOL pthread_win32_process_attach_np (void);

BOOL pthread_win32_thread_attach_np (void);

鍦ㄧ▼搴忛鍑烘椂瑕佽皟鐢細

BOOL pthread_win32_thread_detach_np (void);

BOOL pthread_win32_process_detach_np (void);

姣旇緝閫氱敤鐨勫仛娉曟槸鍦ㄦā鍧桳oad鍜孶nLoad鐨勬椂鍊欏仛榪欎釜attach鍜宒etach鎿嶄綔錛屽涓嬮潰鎵紺猴細

/* Callback for our DLL so we can initialize pthread */

BOOL WINAPI DllMain( HANDLE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )

{

#ifdef PTW32_STATIC_LIB

    switch( fdwReason )

    {

        case DLL_PROCESS_ATTACH:

            pthread_win32_process_attach_np();

        case DLL_THREAD_ATTACH:

            pthread_win32_thread_attach_np();

            break;

        case DLL_THREAD_DETACH:

            pthread_win32_thread_detach_np();

            break;

        case DLL_PROCESS_DETACH:

            pthread_win32_thread_detach_np();

            pthread_win32_process_detach_np();

            break;

    }

#endif

    return TRUE;

}

娉ㄦ剰錛?PTW32_STATIC_LIB 瀹忎負pthread闈欐佺紪璇戠殑鏍囧織錛岃繖涓彲浠ラ氳繃pthread.h鐨勯厤緗垨鑰匔FLAGS浼犻掕繘鏉ャ?br>涓嬮潰鏄痯thread鐨勫畼鏂圭殑dll.c鐨勫疄鐜?br>BOOL WINAPI
DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
{
  BOOL result = PTW32_TRUE;
  switch (fdwReason)
    {
    case DLL_PROCESS_ATTACH:
      result = pthread_win32_process_attach_np ();
      break;
    case DLL_THREAD_ATTACH:
      /*
       * A thread is being created
       */
      result = pthread_win32_thread_attach_np ();
      break;
    case DLL_THREAD_DETACH:
      /*
       * A thread is exiting cleanly
       */
      result = pthread_win32_thread_detach_np ();
      break;
    case DLL_PROCESS_DETACH:
      (void) pthread_win32_thread_detach_np ();
      result = pthread_win32_process_detach_np ();
      break;
    }
  return (result);
} /* DllMain */
涔熷氨鏄pthread瀹樻柟浠g爜鍦ㄥ姩鎬佺紪璇戠殑鐗堟湰涓富鍔ㄥ仛浜嗚繖涓猘ttach鍜宒etach鎿嶄綔銆?br>鑰岄潤鎬佺紪璇戠増鏈敱浜庢病鏈変竴涓悎閫傜殑鍦版柟鏉ュ仛榪欎歡浜嬶紝灝卞皢attach鍜宒etach鐨勭殑鎿嶄綔鎵旂粰鐢ㄦ埛鏉ュ畬鎴愪簡銆?br>涓婇潰鐨勪唬鐮佹槸閽堝璋冪敤鏂規槸Dll鐨勬儏鍐靛仛鐨勫垵濮嬪寲錛屽鏋滆皟鐢ㄦ柟涓嶆槸Dll鍛紵瀵規鍙互鍙傜収濡備笅鍋氭硶錛岃櫧鐒跺緢鏆村姏錛屼絾寰堢畝鍗曪紝鍙互宸ヤ綔
1錛夊畾涔夊涓嬪嚱鏁?br>#ifdef PTW32_STATIC_LIB
static void detach_ptw32(void)
{
    pthread_win32_thread_detach_np();
    pthread_win32_process_detach_np();
}
#endif
2錛夊湪浣犵殑涓葷▼搴忕殑鍏ュ彛澶勶紝涓鑸岃█鏄痬ain()涓仛濡備笅璋冪敤鍗沖彲
#ifdef PTW32_STATIC_LIB
    pthread_win32_process_attach_np();
    pthread_win32_thread_attach_np();
    atexit(detach_ptw32);
#endif
 
涔熷氨鏄敤atexit()灝哾etach宸ヤ綔鎸傛帴鍒扮▼搴忎腑鍘伙紝浣垮緱紼嬪簭鍦ㄩ鍑虹殑鏃跺欏彲浠ュpthread榪涜detach.



]]>
亚洲香蕉网久久综合影视| 久久亚洲精品成人无码网站| 国产精品欧美久久久天天影视| 韩国三级大全久久网站| 久久精品这里只有精99品| 久久这里只有精品首页| 国产精品99久久精品| 精品久久久久久久国产潘金莲| 一本色道久久88—综合亚洲精品 | 一级做a爱片久久毛片| 色婷婷久久综合中文久久一本| 精产国品久久一二三产区区别| 国产美女久久久| 午夜欧美精品久久久久久久| 精品久久久久久久中文字幕| 久久人人妻人人爽人人爽| 久久久久久国产精品免费免费| 久久久久亚洲AV无码专区体验| 久久久久国产精品麻豆AR影院 | 国内精品伊人久久久久av一坑| 久久最新免费视频| 国产精品综合久久第一页| 欧美一区二区三区久久综合| 亚洲欧洲久久av| 久久久久国产成人精品亚洲午夜| 色综合合久久天天综合绕视看| 久久久久久国产精品无码下载 | 久久精品a亚洲国产v高清不卡| 亚洲国产成人精品91久久久 | 久久99免费视频| 国产精品久久久福利| 日韩精品无码久久久久久| 一本一道久久综合狠狠老| 久久精品国产免费观看| 久久久久亚洲av综合波多野结衣| 久久综合偷偷噜噜噜色| 青青热久久国产久精品 | 久久香蕉超碰97国产精品| 日韩人妻无码精品久久免费一| 无码久久精品国产亚洲Av影片 | 91麻精品国产91久久久久|