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

Linux ºÍ ¶àÏß³Ì

ÿ´Î¶¼ÊÇÓõ½£¬²éһϣ¬Ð´Ï£¬Õâ´ÎÉÔ΢¼Ç¼Ï±ʼǡ£
ºÍThreadÏà¹Ø£¬»ù±¾µÄÓÐ3¸ö¸ÅÄÏ̵߳Ľ¨Á¢ºÍÏú»Ù£»Ïß³ÌËø£»Ïß³ÌÌõ¼þ
¹ØÓÚ½¨Á¢Ị̈߳º
ret = pthread_create(&thread_id, NULL, Do_Thread, &Do_Thread_Para);
// µÚ2²ÎÊýÊÇthread ÊôÐÔ£¬Ò»°ãÎÒ²»ÓÃÉèÖÃ
// µÚ4¸ö²ÎÊýÊÇDo_ThreadµÄÈë¿Ú²ÎÊý£¬Ò»°ãÎÒ´«Ò»¸ö½á¹¹Ìå½øÈ¥
¹ØÓÚÏú»ÙỊ̈߳º
µÈ´ýÏ߳̽áÊø£ºpthread_join
Ç¿ÐÐɱµôỊ̈߳ºpthread_exit
ÈÃÏß³Ì×ÔÉú×ÔÃð£ºpthread_detach
ÎÒÒ»°ãÓõÄÊǵÚÒ»¸ö£º
pthread_join(thread_id, &Do_Thread_ret);
// µÚ¶þ¸ö²ÎÊýÊÇÏ̷߳µ»ØÖµ 
¹ØÓÚÏß³ÌËø£ºµ±ÒªÔÚ¶à¸öÏ̹߳²ÏíijЩ±äÁ¿µÄʱºò£¬¾ÍÐèÒªÓÃËø¡£ÕâÑù¿ÉÒÔ±£Ö¤Ò»¸öʱ¼äµã£¬Ö»ÓÐÒ»¸öÏß³ÌÄܹ»·ÃÎÊÕâ¸öÏß³Ì
pthread_mutex_t mMutexData£»
pthread_mutex_init(&(mMutexData), NULL); // µÚ2¸ö²ÎÊýÊÇËøµÄÊôÐÔ£¬ÎÒÒ»°ãÓÃĬÈÏ£¬NULL
pthread_mutex_lock(&mMutexData);  // ¼ÓËø
pthread_mutex_unlock(&mMutexData) // È¥Ëø
pthread_mutex_destroy(&mMutexData) // Ïú»Ù
¹ØÓÚÌõ¼þ£ºµ±Ä³¸öÏß³ÌÐèÒªµÈ´ýÆäËûÏ̴߳¦ÀíÍêij¸öÊý¾Ý£¨ÔËÐе½Ä³¸öµã£©µÄ»°£¬¾ÍÐèÒªÓÃÌõ¼þ£¬Ò»°ã¼Ó¸öʱ¼ä²ÎÊý£¬ÒÔ·ÀÖ¹ËÀµÈÏÂÈ¥¡£
pthread_cond_t *sConditionData£»
pthread_cond_init(&(sConditionData), NULL)£» // µÚ2¸ö²ÎÊýÊÇËøµÄÊôÐÔ£¬ÎÒÒ»°ãÓÃĬÈÏ£¬NULL
 pthread_mutex_lock(&mMutexData); // Ò»°ãÌõ¼þ±ØÐëºÍËø¼ÓÔÚÒ»ÆðÓã¬ÒÔ±£Ö¤Ìõ¼þ±äÁ¿²»ÖØÈë
  pthread_cond_signal(&sConditionData); // ·¢ÐźÅ
  pthread_mutex_unlock(&mMutexData);
    struct timespec  ts;
    struct timeval sTime;
    struct timezone sTimeZone£»
   long res;
  pthread_mutex_lock(&(pApp->mMutexData));
  gettimeofday(&sTime, &sTimeZone);
  ts.tv_sec = sTime.tv_sec;
  ts.tv_nsec += 5sTime. tv_usec * 1000 £«20*1000*1000; // 20 ms
  ret = pthread_cond_timedwait(&(pApp->sConditionData), &(pApp->mMutexData), &ts); // µÈºò
  if(ret == ETIMEDOUT)
  {
   pthread_mutex_unlock(&(pApp->mMutexData));
  


Ïà¹ØÎĵµ£º

LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º


LinuxÄں˴úÂë·ÖÎö slab.c by Áõ¿º liukang@bjut.edu.cn
slab.cÀ´×ÔlinuxÄÚºË2.4.22°æ£¬±¾Îļþ°´ÕÕGNUЭÒé·¢²¼¡£
Ò»¡¢×¼±¸ÖªÊ¶£º
slabµÄ¸ÅÄ
Ìá³öµÄÔ­Òò£ºÓÉÓÚ²Ù×÷ϵͳÔÚÔËÐÐÖл᲻¶Ï²úÉú¡¢Ê¹Óá¢ÊÍ·Å´óÁ¿Öظ´µÄ¶ÔÏó£¬
ËùÒÔ¶ÔÕâÑùµÄÖظ´¶ÔÏóµÄÉú³É½øÐиĽø¿ÉÒÔ´ó´óÌá¸ßЧÂÊ
×îÔçÓÉsunµÄ¹¤³ÌʦÌá³ö(1994Äê)²¢Ê×ÏÈÔ ......

תÔØ ½ñÌìΪÎÒµÄGodaddy LinuxÖ÷»ú¿ªÍ¨SSH

ÒÔÇ°GodaddyµÄLinuxµÄÖ÷»úÊDz»ÄÜ¿ªÍ¨SSHµÄ£¬Ö»ÓÐVDS¡¢VPS¡¢¶ÀÁ¢Ö÷»ú¿ÉÒÔ¿ªÍ¨£¬Ç°¼¸ÌìÔÚºǫ́ÉÏ¿´µ½ÓÐÁËSSHÕâ¸ö¹¦ÄÜ£¬²»¹ýÐèҪɾ³ýËùÓеÄÊý¾Ý¿â£¬²Å¿ÉÒÔ½øÐпªÍ¨µÄ²½Ö衣ǿÁÒ½¨Ò鱸·ÝÊý¾Ý¿â¼°ÍøÕ¾£¡£¡
ɾ³ýÊý¾Ý¿â¾Í²»ÓÃ˵ÁË¡«ºÜ¼òµ¥¡£
²½Ö裺½øÈë¿Õ¼ä¹ÜÀíÃæ°å£¬Ñ¡ÔñSettingsÑ¡ÏϵÄSSHÑ¡ÏÈçÏÂͼ£º
godaddyssh-thumb. ......

Linux ϳ£ÓÃС¹¤¾ß¼¯

1 ¾­³£ÐèÒª¿Ì¼ ISO Îļþ£¬cdrecord ¿ÉÒÔʵÏÖ
cdrecord ÆäʵÊÇÒ»¸öÈíÁ´½Ó
lrwxrwxrwx 1 root root 5 2009-05-04 22:42 /usr/bin/cdrecord -> wodim
¿Ì¼µÄÃüÁîÈçÏ£º
wodim -v dev=6,0,0 xx.iso # dev ¿ÉÒÔÓà --scanbus ²é¿´
2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ