Linux¶àÏ̱߳à³ÌµÄ»ù±¾µÄº¯Êý
º¯ÊýÔÐÍ£º
#include <pthread.h>
int pthread_create(pthread_t *restrict tidp,const pthread_attr_t *restrict attr, void *(*start_rtn)(void),void *restrict arg);
·µ»ØÖµ£ºÈôÊdzɹ¦½¨Á¢Ï̷߳µ»Ø0,·ñÔò·µ»Ø´íÎóµÄ±àºÅ
ÐÎʽ²ÎÊý£º
pthread_t *restrict tidp Òª´´½¨µÄÏ̵߳ÄÏß³ÌidÖ¸Õë
const pthread_attr_t *restrict attr ´´½¨Ïß³ÌʱµÄÏß³ÌÊôÐÔ
void* (start_rtn)(void) ·µ»ØÖµÊÇvoidÀàÐ͵ÄÖ¸Õ뺯Êý
vodi *restrict arg start_rtnµÄÐвÎ
ÀýÌâ1£º
¹¦ÄÜ£º²âÊÔ½¨Á¢Ò»¸öеÄÏß³Ì
³ÌÐòÃû³Æ£º pthread_test.c
#include <pthread.h>
#include <stdio.h>
void *create(void *arg)
...{
printf("new thread created ..... ");
}
int main(int argc,char *argv[])
...{
pthread_t tidp;
int error;
error=pthread_create(&tidp,NULL,create,NULL);
if(error!=0)
......{
printf("pthread_create is not created ... ");
return -1;
}
printf("prthread_create is created... ");
return 0;
}
±àÒë·½·¨£º
#gcc -Wal
Ïà¹ØÎĵµ£º
LinuxÏÂmbstring°²×°
1¡¢ÓÃcdÃüÁî½øÈëphpµÄÔ´´úÂëĿ¼ÏµÄetc/mbstringĿ¼Ï£¬Èç“/src/php5.2.5”£¬¼´“cd /src/php5.2.5”;
2¡¢>/usr/local/php/bin/phpize £¨¼ÙÉèphp°²×°ÔÚ/usr/local/phpĿ¼Ï£©
3¡¢±àÒëÅäÖã¬>./configure --with-php-config=/usr/local/php/bin/php-config
4¡¢Ö´ÐÐ ......
MEMCACHED°²×°
Ò»¡¢·þÎñ¶Ë¡£ÏȰ²×°libevent£¬ÔÙ°²×°memcached¡££¨×¢£ºlibeventÊÇÒ»Ì×¿çÆ½Ì¨µÄʼþ´¦Àí½Ó¿ÚµÄ·â×°£¬Äܹ»¼æÈݰüÀ¨£ºWindows/Linux/BSD/SolarisµÈ²Ù×÷ϵͳµÄʼþ´¦Àí£©
1¡¢ÏÂÔØ×îа汾µÄlibeventºÍmemcached£¬±ÊÕߵݲװĿ¼Ϊ/soft
>cd /soft
>wget http://www.dange.com/memcached/dist/memcach ......
¸ú×ÙϵͳµÄÊä³ö:
strace
ÀýÈç: strace -p 9034 -x -s 2048
-p ½ø³ÌºÅ
-x ²»ÊÇASCIIµÄÊä³öÓÃHEX±íʾ
-s ÿ´ÎÊä³öµ ......
ÔÎĵØÖ·£ºhttp://www.wangzhongyuan.com/archives/487.html
ÒÔÏÂÊÇÒ»¸öLinux/UnixÏÂÏÔʾijһĿ¼ÏÂÎļþÁбíµÄC³ÌÐò£¬Ï൱ÓÚ×î»ù±¾µÄlsÃüÁîµÄ¹¦ÄÜ£¬ÏÔʾµÄÄÚÈݱ¨¸æ¸ÃĿ¼ÏµÄ×ÓĿ¼ÒÔ¼°ÎļþÃû:
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
int m ......