Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux C ʵÏÖÏ̳߳Ø

×î½ü×öµÄһЩ¹¤×÷ÐèÒªÓõ½Ï̳߳ؼ¼Êõ£¬Òò´Ë²Î¿¼ÁËһЩ×ÊÁϺÍÊé¼®£¬Èç¡¶0bug c/c++ÉÌÓù¤³ÌÖ®µÀ¡·¡£
Ϊ´ËÔÚlinuxƽ̨ÉÏÓô¿cдÁËÒ»¸öÏ̳߳صÄʵÏÖ¡£
ÔÚ´ËÁгöÁËÔ­´úÂë¡£
Ö÷ÒªÓõ½µÄÊý¾Ý½á¹¹ÓÐ
1.struct  thread_pool_t    // thread pool µÄʵÏÖ´úÂë
2.struct thread_pool_token_t    //ÔÚthread pool ÖÐÓõ½µÄ½á¹¹£¬Ò»¸ö¸ÃÀàÐͱäÁ¿´ú±íÒ»ÌõÏß³Ì
3.struct thread_pool_job_t     //µ±Ïßǰ³Ì´¦Àí¸ÃÈÎÎñ½«»Øµ÷½á¹¹
Éè¼ÆË¼Â·£º
Ö÷Ï̴߳´½¨Ï̳߳صĿØÖÆỊ̈߳¬
¹ÜÀíÏ߳̽«½øÈëÑ­»·À´×öÒÔÏÂÊÂÇ飺
1.Èç¹ûµ±Ç°¿ÕÏнø³Ì²»×ã²¢ÇÒ×ÜÏß³ÌÊýûÓдﵽÉÏÏÞ£¬½«´´½¨Ò»Ìõ¿ÕÏÐỊ̈߳¬ÖÁµÀ¿ÕÏÐÏ̴߳ﵽ3Ìõ£¨¼ûTHREAD_POOL_MIN_IDLE_SIZE£©
2.²»¶Ï¼ì²é¹¤×÷ÈÎÎñ¶ÓÁУ¬ÓÐÔò°²ÅÅÒ»Ìõ¿ÕÏÐÏ̶߳ԸÃÈÎÎñ½øÐд¦Àí
ÆÕͨÏ̱߳»¹ÜÀíÏ̴߳´½¨ºóÒ²½«½øÈëÑ­»·À´×öÒÔÏÂÊÂÇ飺
1.¼ì²éµ±Ç°assignµÄthread_pool_token_t½á¹¹µÄ״̬£¬Èç¹ûÊÇTREAD_POOL_STATE_BUSYÔòµ÷ÓÃthread_pool_token_tËù×¢²áµÄ»Øµ÷º¯ÊýÀ´´¦ÀíÈÎÎñ¡£
2.Íê³É¸ÃÈÎÎñºó¼ì²âµ±Ç°¿ÕÏнø³Ì¹»²»¹»£¬Èç¹ûÌ«¶àÔòÍ˳ö±¾Ị̈߳¬·ñÔò»á¸ÄдÔËÐÐ״̬ΪTREAD_POOL_STATE_IDLEºó¼ÌÐøÑ­»·
×¢²áÈÎÎñ£º
1.µ±Ã»ÓпÕÏÐÏ߳̿ÉÓÃʱ½«°Ñ¸ÃÈÎÎñ¼ÓÈ빤×÷ÈÎÎñ¶ÓÁУ¨Ð趨Òå_THREAD_POOL_JOB_LIST_£©£¬ÒÔ±¸½«À´ÓпÕÏÐÏß³ÌÊÇÄܹ»½øÐд¦Àí¡£
Ö÷ÒªÎļþ £º
1.thread_pool.h
 
#ifndef _LIB_DOL_THREAD_POOL_H_
#define _LIB_DOL_THREAD_POOL_H_
#include "thread_pool.def"
#include <pthread.h>
#define THREAD_POOL_MIN_SIZE      5     /* at least 5 threads, 4 job + 1 manage thread */
#define THREAD_POOL_MIN_IDLE_SIZE 3     /* at least 3 threads idle to improve the efficiency */
#define THREAD_POOL_DEFAULT_SIZE  10    /* default threads in thread pool */
#define THREAD_POOL_MAX_SIZE      100   /* max threads in thread pool */
#define TREAD_POOL_STATE_NOTRUN   0
#define TREAD_POOL_STATE_IDLE     1
#define TREAD_POOL_STATE_BUSY     2
#define TREAD_POOL_REG_OK         0
#define


Ïà¹ØÎĵµ£º

Linux µÄ¶àÏ̱߳à³ÌµÄ¸ßЧ¿ª·¢¾­Ñé

2009 Äê 4 ÔÂ 23 ÈÕ
±¾ÎÄÖÐÎÒÃÇÕë¶Ô Linux É϶àÏ̱߳à³ÌµÄÖ÷ÒªÌØÐÔ×ܽá³ö 5 Ìõ¾­Ñ飬ÓÃÒÔ¸ÄÉÆ Linux ¶àÏ̱߳à³ÌµÄϰ¹ßºÍ±ÜÃâÆäÖеĿª·¢ÏÝÚå¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃÇ´©²åһЩ Windows µÄ±à³ÌÓÃÀýÓÃÒÔ¶Ô±È Linux ÌØÐÔ£¬ÒÔ¼ÓÉî¶ÁÕßÓ¡Ïó¡£
±³¾°
Linux ƽ̨ÉϵĶàÏ̳߳ÌÐò¿ª·¢Ïà¶ÔÓ¦ÆäËûƽ̨£¨±ÈÈç Windows£©µÄ¶àÏß³Ì API ÓÐһЩϸ΢ ......

¹ØÓÚLINUXÖеÄFORKº¯Êý

Ò»Ö±ÏëдµãLINUXÖеÄFORKº¯Êý,µ«ÊǰÉ,ÎÒʵÔÚÊÇÌ«ÀÁÁË,ÔÙ¼ÓÉÏÎIJɲ»ÔõôºÃ,ËùÒԾʹÓÍøÉÏÕÒÁËÆªÐ´µÄ²»´íµÄÎÄÕÂ,¿´ÍêÖ®ºóÓ¦¸Ã¶ÔFORKº¯ÊýÓÐÒ»¶¨µÄÁ˽â~~
 
¸ø³öÈçÏÂC³ÌÐò£¬ÔÚlinuxÏÂʹÓÃgcc±àÒ룺
1 #include "stdio.h"
2 #include "sys/types.h"
3 #include "unistd.h"

5  int  main()
6 ......

LinuxÃüÁî find grep vim²å¼þ

linux find ÃüÁîʹÓÃ
-name Ñ¡Ïî
ÎļþÃûÑ¡ÏîÊÇfindÃüÁî×î³£ÓõÄÑ¡ÏҪôµ¥¶ÀʹÓøÃÑ¡ÏҪôºÍÆäËûÑ¡ÏîÒ»ÆðʹÓá£
¿ÉÒÔʹÓÃijÖÖÎļþÃûģʽÀ´Æ¥ÅäÎļþ£¬¼ÇסҪÓÃÒýºÅ½«ÎļþÃûģʽÒýÆðÀ´¡£
ÏëÒªµÄµ±Ç°Ä¿Â¼¼°×ÓĿ¼ÖвéÕÒÎļþÃûÒÔÒ»¸ö´óд×Öĸ¿ªÍ·µÄÎļþ£¬¿ÉÒÔÓãº
$ find . -name "[A-Z]*" -print
ÏëÒªÔÚ/etcĿ¼Öв ......

linuxϵͳϰ²×°flashplayer

µÚÒ»²½:ÏÂÔØFLASHµÄ²å¼þ
 
http://www.adobe.com/ÔÚÕâ¸öÒ³ÃæÉÏÓкܶà²å¼þ,ÔÚÕâÀïÄãÖ»ÓÃÏÂÔØ
 
ÎļþÃû×Ö:install_flash_player_9_linux.tar.gz
 
 
µÚ¶þ²½:½âѹÎļþ°ü
 
µ±Ç°µÄ¹¤×÷Ŀ¼ÊÇ:USR
 
[root@isitqnx usr]#tar zvxf install_flash_player_7_linux.tar.gz µÃµ½Ò»¸öͬÃûÎļ ......

ÈçºÎʹÓ÷ºÐÍÄ£擬virtual? (C/C++) (template)

ÍøÉÏÒ»µÀ½ðɽµÄÃæÊÔÌ⣺
http://topic.csdn.net/u/20100524/14/0eff992a-2849-4db6-bdaa-d4a200e79b7c.html
Çë·Ö±ðÓÃC++µÄÃæÏò¶ÔÏóºÍ·ºÐÍ»úÖÆ£¬±àдʵÏÖTemplate MethodģʽµÄʾÀý´úÂ룬²¢±È½ÏÁ½ÖÖ·½Ê½¸÷×ÔµÄÓÅȱµã¡£
ÓÃÐ麯ÊýʵÏÖTemplate MethodµÄ·½Ê½¾Í²»¶à˵ÁË¡£Ó÷ºÐ͵ķ½Ê½ÊµÏÖ¶à̬ÔÚATLÀïÃæÓдóÁ¿µÄÓõ½£¡
·ºÐ͵ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ