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

linux¶àÏ̱߳à³É - Linux/UnixÉçÇø / ³ÌÐò¿ª·¢Çø

#include<stdio.h>
#include<stdlib.h>
#include<pthread.h>

void *first()
{
printf("first pthread-----ABC\n");
}

void *second()
{
printf("second pthread-----ABC\n");
}

int main()
{
printf("mian pthread----ABC\n");
pthread_t fthread;
pthread_t sthread;

pthread_create(&fthread,NULL,first,NULL);
pthread_create(&sthread,NULL,second,NULL);

pthread_join(fthread,NULL);
pthread_join(sthread,NULL);
return 0;
}

ÎÒ±àÒëÌáʾ´íÎóÈçÏÂ
fily@zhaoyf:/media/work/develop/iscsitarget/usr$ gcc -o thread thread.c
/tmp/ccRbUIwW.o: In function `main':
thread.c:(.text+0x4e): undefined reference to `pthread_create'
thread.c:(.text+0x66): undefined reference to `pthread_create'
thread.c:(.text+0x74): undefined reference to `pthread_join'
thread.c:(.text+0x82): undefined reference to `pthread_join'
collect2: ld returned 1 exit status

¸ßÊÖ°ïæ£¬ÎÒ´íÔÚÄÄÀïÁË£¿
ÎÒʹÓõÄÊÇdebian5linux{{


Ïà¹ØÎÊ´ð£º

ÊÇÑ¡win2008»¹ÊÇsuse linux¡¢redhat¡¢centos,ÓÌÔ¥ÖÐ

ÒýÓÃÄÚÈÝvsking 2009-12-25 22:56:52
ÏÖÔÚÊÇwin2008ºÍiis8µÄʱ´úÁË£¬²»Òª»¹Í£ÁôÔÚiis5ʱ´ú£¬win2008±»ÆÀΪʮ¼Ñ²Ù×÷ϵͳ֮Êײ»ÊÇżȻµÄ£¬ÄãÒªÊÇ..
ÎÒµÄÎÊÌâÊÇ£º
×î½üÏëÂò¸ö·þÎñÆ÷£¬¿´ÁËdellÉϵÄϵͳ¶¨ÖÆÑ¡Ôñ£¬Ò»Ð© ......

Linux -- pthread_mutex_lockÎÊÌâ - C/C++ / C++ ÓïÑÔ

int dValue = pthread_mutex_lock(&g_ThreadMutex);
if (0 != dValue)
{
. pthread_mutex_unlock(&g_ThreadMutex);
. return pToDealing;
}
----------------ʧ°Üºó£¬ÔÙµ÷ÓúìÉ«²¿·Ö£¬»á²»»áµ¼Ö³ÌÐ ......

ÈçºÎ¿ªÊ¼Ñ§Ï° Linux ÄÚºË [ת] - C/C++ / ·Ç¼¼ÊõÇø

> Message: 1
> Date: Sat, 24 Apr 2010 11:31:02 +1000
> from: Crossfire <xfire@xware.cx>
> Subject: Re: [coders] New to Kernel programming and device drivers
> To: coders@slug. ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ