Linux²Ù×÷ϵͳϵĶàÏ̱߳à³ÌÏêϸ½âÎö£¨4£©
º¯ÊýÔÐÍ£º
#include <pthread.h>
void pthread_cleanup_push(void (*rtn)(void *),void *arg);
º¯ÊýrtnÊÇÇåÀíº¯Êý£¬argÊǵ÷ÓòÎÊý
void pthread_cleanup_pop(int execute);
ÔÚÇ°Ãæ½²¹ýÏ̵߳ÄÖÕÖ¹·½Ê½£¬ÊÇÕý³£ÖÕÖ¹»¹ÊÇ·ÇÕý³£ÖÕÖ¹£¬¶¼»á´æÔÚÒ»¸ö×ÊÔ´ÊͷŵÄÎÊÌ⣬ÔÚposixÖÐÌṩÁËÒ»×飬¾ÍÊÇÎÒÃÇÉÏÃæ¿´µÄº¯Êý½øÐÐÏß³ÌÍ˳öµÄ´¦Àíº¯Êý£¬ÓÐЩÏñÔÚ½ø³ÌÖеÄatexitº¯Êý¡£Êͷŵķ½Ê½ÊÇÖ¸pthread_cleanup_pushµÄµ÷Óõ㵽pthread_cleanup_popÖ®¼ä³ÌÐò¶Î½øÐÐÖÕÖ¹¡£
pthread_cleanup_push()/pthread_cleanup_pop²ÉÓÃÏÈÈëºó³öµÄ·½Ê½µÄÕ»µÄ¹ÜÀí·½Ê½£¬void *rtn(void *),ÔÚÖ´ÐÐpthread_cleanup_push()ʱѹÈ뺯ÊýÕ»£¬¶à´ÎÖ´ÐÐpthread_cleanup_push()ÐγÉÒ»¸öº¯ÊýÁ´£¬ÔÚÖ´ÐÐÕâ¸öº¯ÊýÁ´µÄʱºò»áÒÔ·´·½Ïòµ¯³ö£¬¼´ÏÈÈëºó³ö¡£execute²ÎÊý±íʶ£¬ÊÇ·ñÖ´Ðе¯³öÇåÀíº¯Êý£¬µ±execute=0ʱ²»½øÐе¯³öÇåÀíº¯Êý£¬·ÇÁãµÄʱºòµ¯³ö´¦Àíº¯Êý¡£
Àý³Ì9
³ÌÐòÄ¿µÄ£ºÊµÏÖÔÚÕý³£½áÊøÏ̵߳Äʱºò£¬½øÐк¯Êý´¦Àí
³ÌÐòÃû³Æ£ºpthread_clean.c
/********************************************************************************************
** Name:pthread_clean.c
** Used to study the multithread programming in Linux OS
** A example showing a thread to be cleaned.
** Author:zeickey
** Date:2008/6/28
** Copyright (c) 2006,All Rights Reserved!
*********************************************************************************************/
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
void *clean(void *arg)
{
printf("cleanup :%s \n",(char *)arg);
return (void *)0;
}
void *thr_fn1(void *arg)
{
printf("thread 1 start \n");
pthread_cleanup_push( (void*)clean,"thread 1 first handler");
pthread_cleanup_push( (void*)clean,"thread
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
£¨L2CAPÐÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPÐÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼Á¬½Ó¿ØÖƺÍÊÊÅäÐÒé (L2CAP) ΪÉϲãÐÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àÐÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãÐÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......
LinuxϵĿâ--ÖØÒªµÄ´úÂ븴ÓûúÖÆ¡¾×ª¡¿
2008-03-26 17:57
±¾ÎÄÖ÷Òª½â¾öÒÔϼ¸¸öÎÊÌâ
1 ΪʲôҪʹÓÿ⣿
2 ¿âµÄ·ÖÀà
3 ´´½¨×Ô¼ºµÄ¿â
»òÐí´ó¼Ò¶Ô×Ô¼º³õѧ
linuxʱµÄÇéÐÎÈÔ¼ÇÒäÓÈаɡ£Èç¹ûûÓÐÒ»¸öÄܽϺõĽâ¾öÒÀÀµ¹ØϵµÄ°ü¹ÜÀíÆ÷£¬ÔÚlinuxÏ°²×°Èí¼þ½«ÊÇÒ»¼þ¼°ÆäÍ´¿àµÄ¹¤×÷¡£Äã×°a°üʱ£¬¿ÉÄÜ»áÌáʾ
ÄãÒªÏÈ×°b°ü£¬ ......
2009-10-27
1£¬ÖØÆô reboot
2009-10-28
1,Íü¼ÇÁËrootÓû§ÃÜÂëµÄ½â¾ö°ï
Æô¶¯ºó°´esc½øÈëÐÞ¸´Ä£Ê½£¬Ñ¡ÔñÐÞ¸´£¬²¢Ñ¡Ôñ×îºóÒ»¸ö¡£root£¬½øÈ¥ºó£¬¸ü¸ÄÃÜÂ룺passwd root
È»ºó¸ù¾ÝÌáʾÊäÈëÁ½´ÎÃÜÂë¾ÍÐÐÁË¡£
2009-10-29
1,ls
ls -a ²é¿´ËùÓÐÎļþ
ls -l ²é¿´ÏêϸµÄÊôÐÔ
&nbs ......
¡¶Unix/LinuxϵÄCurses¿â¿ª·¢Ö¸ÄÏ¡·ÓÚ2003ÄêÓÉÇ廪³ö°æÉç³ö°æ£¬ºÏͬÔÚ2008Äê½áÊø¡£ÕâÊǹúÄÚΨһµÄÒ»±¾¹ØÓÚCurses¿â¿ª·¢Ö¸ÄϵÄͼÊé¡£±¾ÊéÎÞÒâÔٰ棬Òò´ËÌØÒ⹫¿ªÈ«ÊéÄÚÈÝ£¬ËùÓеÄÕ½ڻáÖ𽥷ųö¡£Ï£Íû¶Ô´ó¼ÒÓÐÓᣠ......