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

Linux¶àÏ̱߳à³Ì»ù´¡

LinuxϵͳϵĶàÏß³Ì×ñÑ­POSIXÏ߳̽ӿڣ¬³ÆΪpthread¡£±àдLinuxϵĶàÏ̳߳ÌÐò£¬ÐèҪʹÓÃÍ·Îļþpthread.h£¬Á¬½Óʱ
ÐèҪʹÓÿâlibpthread.a¡£Ë³±ã˵һÏ£¬LinuxÏÂpthreadµÄʵÏÖÊÇͨ¹ýϵͳµ÷ÓÃclone£¨£©À´ÊµÏֵġ£clone£¨£©ÊÇLinux
ËùÌØÓеÄϵͳµ÷Óã¬ËüµÄʹÓ÷½Ê½ÀàËÆfork£¬¹ØÓÚclone£¨£©µÄÏêϸÇé¿ö£¬ÓÐÐËȤµÄ¶ÁÕß¿ÉÒÔÈ¥²é¿´ÓйØÎĵµËµÃ÷¡£ÏÂÃæÎÒÃÇչʾһ¸ö×î¼òµ¥µÄ¶àÏ̳߳ÌÐò
example1.c¡£
/* example.c*/
#include <stdio.h>
#include <pthread.h>
void thread(void)
{
int i;
for(i=0;i<3;i++)
printf("This is a pthread.\n");
}
int main(void)
{
pthread_t id;
int i,ret;
ret=pthread_create(&id,NULL,(void *) thread,NULL);
if(ret!=0)
{
   printf ("Create pthread error!\n");
   exit (1);
}
for(i=0;i<3;i++)
   printf("This is the main process.\n");
pthread_join(id,NULL);
return (0);
}
±àÒ룺gcc -o thread1 thread1.c -lpthread
ÔËÐнá¹û
This is the main process.
This is the main process.
This is the main process.
This is a pthread.
This is a pthread.
This is a pthread.
pthread_tÔÚÍ·Îļþ/usr/include/bits/pthreadtypes.hÖж¨Ò壺
typedef unsigned long int pthread_t;
ËüÊÇÒ»¸öÏ̵߳ıêʶ·û¡£º¯Êýpthread_createÓÃÀ´´´½¨Ò»¸öỊ̈߳¬ËüµÄÔ­ÐÍΪ£º
extern
int pthread_create __P ((pthread_t *__thread, __const pthread_attr_t
*__attr,void *(*__start_routine) (void *), void *__arg));
µÚÒ»¸ö²ÎÊýΪָÏòÏ̱߳êʶ·ûµÄÖ¸Õ룬µÚ¶þ¸ö²ÎÊýÓÃÀ´ÉèÖÃÏß³ÌÊôÐÔ£¬µÚÈý¸ö²ÎÊýÊÇÏß³ÌÔËÐк¯ÊýµÄÆðʼµØÖ·£¬×îºóÒ»¸ö²ÎÊýÊÇÔËÐк¯ÊýµÄ²ÎÊý¡£ÕâÀÎÒÃǵÄ
º¯Êýthread²»ÐèÒª²ÎÊý£¬ËùÒÔ×îºóÒ»¸ö²ÎÊýÉèΪ¿ÕÖ¸Õë¡£µÚ¶þ¸ö²ÎÊýÎÒÃÇÒ²ÉèΪ¿ÕÖ¸Õ룬ÕâÑù½«Éú³ÉĬÈÏÊôÐÔµÄÏ̡߳£¶ÔÏß³ÌÊôÐÔµÄÉ趨ºÍÐÞ¸ÄÎÒÃǽ«ÔÚÏÂÒ»
½Ú²ûÊö¡£µ±´´½¨Ï̳߳ɹ¦Ê±£¬º¯Êý·µ»Ø0£¬Èô²»Îª0Ôò˵Ã÷´´½¨Ïß³Ìʧ°Ü£¬³£¼ûµÄ´íÎ󷵻شúÂëΪEAGAINºÍEINVAL¡£Ç°Õß±íʾϵͳÏÞÖÆ´´½¨ÐµÄỊ̈߳¬
ÀýÈçÏß³ÌÊýÄ¿¹ý¶àÁË£»ºóÕß±íʾµÚ¶þ¸ö²ÎÊý´ú±íµÄÏß³ÌÊôÐÔÖµ·Ç·¨¡£´´½¨Ï̳߳ɹ¦ºó£¬Ð´´½¨µÄÏß³ÌÔòÔËÐвÎÊýÈýºÍ²ÎÊýËÄÈ·¶¨µÄº¯Êý£¬Ô­À´µÄÏß³ÌÔò¼ÌÐøÔËÐÐÏÂÒ»
ÐдúÂë¡£
º¯Êýpthread_joinÓÃÀ´µÈ´ýÒ»¸öÏ̵߳ĽáÊø¡£º¯ÊýÔ­ÐÍΪ£º
extern int


Ïà¹ØÎĵµ£º

Linux iptableÎĵµ

×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......

»ùÓÚǶÈëʽLinuxµÄÊÓƵͼÏñ²É¼¯Óë´«Êä

 
ÕªÒª:ÊÓƵͼÏñ²É¼¯¼°´¦Àí¼¼ÊõÔÚÔ¶³ÌÊÓƵ¼à¿ØºÍ¿ÉÊӵ绰ÖÐÓÐ׏㷺µÄÓ¦ÓÃÇ°¾°£¬Çý¶¯ÊÓƵ²É¼¯É豸ºÍ»ñÈ¡ÊÓƵÊý¾Ý²¢½øÐÐÏàÓ¦µÄ´¦Àí£¬ÊÇʵÏÖÕâЩӦÓõĻù´¡¡£Õë¶ÔÕâЩӦÓ㬹¹½¨ÁËÒ»¸ö»ùÓÚǶÈëʽ LinuxºÍ PXA270΢´¦ÀíÆ÷µÄÊÓƵ²É¼¯Óë´«Êäϵͳ£¬ÀûÓà Video4LinuxʵÏÖ USBÉãÏñÍ·ÊÓƵÊý¾Ý²É¼¯£¬²É¼¯µÄÊÓƵÊý¾Ý¾­ JPEGѹËõº ......

Linux ÃüÁîÐÐ

LinuxÌṩÁË´óÁ¿µÄÃüÁÀûÓÃËü¿ÉÒÔÓÐЧµØÍê³É´óÁ¿µÄ¹¤×÷£¬Èç´ÅÅ̲Ù×÷¡¢Îļþ´æÈ¡¡¢Ä¿Â¼²Ù×÷¡¢½ø³Ì¹ÜÀí¡¢ÎļþȨÏÞÉ趨µÈ¡£ËùÒÔ£¬ÔÚLinuxϵͳÉϹ¤×÷Àë²»¿ªÊ¹ÓÃϵͳÌṩµÄÃüÁî¡£ÒªÏëÕæÕýÀí½âLinuxϵͳ£¬¾Í±ØÐë´ÓLinuxÃüÁîѧÆð£¬Í¨¹ý»ù´¡µÄÃüÁîѧϰ¿ÉÒÔ½øÒ»²½Àí½âLinuxϵͳ¡£
²»Í¬Linux·¢ÐаæµÄÃüÁîÊýÁ¿²»Ò»Ñù£¬µ«Linux·¢ÐÐ°æ± ......

Linux °²×°SVN

ÆäʵLinuxÏÂSVN»¹ÊDZȽϼòµ¥£¬ ÔÚÍøÉÏ£¬ Ò»ËѾÍÊÇÒ»´ó°ÑµÄ×ÊÁÏ¡£ µ«ºÜÉÙÓÐÈËÒ»´Î°²×°³É¹¦£¬ ÒòΪLinuxÖеĻ·¾³Ì«¸´ÔÓ£¬
ºÜÈÝÒ×»·¾³³åÍ»¡£
linux svnÒ»°ãÒÀÀµÓÚhttpd£¨Apache Web·þÎñÆ÷£©.
svn¶ÀÁ¢·½Ê½
µ±È»svn»¹ÓжÀÁ¢·½Ê½£¬ ¼´²»ÐèÒªapache·þÎñÆ÷, ¼´Ìø¹ýÏÂÃæµÄapache°²×°£¬ ¼°ÅäÖÃÖйØÓÚhttpd.conf²¿·Ö¡£
ÔÚ±àÒës ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ