LinuxÖеŤ×÷¶ÓÁÐ(work queue)
¹¤×÷¶ÓÁÐ(work queue)ÊÇLinux kernelÖн«¹¤×÷ÍƺóÖ´ÐеÄÒ»ÖÖ»úÖÆ¡£ÕâÖÖ»úÖƺÍBH(bottom half)»òTasklets²»Í¬Ö®´¦ÔÚÓÚ¹¤×÷¶ÓÁÐÊÇ°ÑÍƺóµÄ¹¤×÷½»ÓÉÒ»¸öÄÚºËÏß³ÌÈ¥Ö´ÐУ¬Òò´Ë¹¤×÷¶ÓÁеÄÓÅÊƾÍÔÚÓÚËüÔÊÐíÖØе÷¶ÈÉõÖÁ˯Ãß¡£
linux 2.6.20ÒԺ󣬹¤×÷¶ÓÁлúÖƺÍ֮ǰµÄ°æ±¾ÓÐÒ»µã²»Í¬£¬ÔÚÍøÉÏÕÒÁËÒ»µã×ÊÁÏ£¬Ò²ÏàÓ¦µÄ¿´ÁËһЩcode£¬ÏÖÔÚ×Ô¼º×ܽáһϣº
ÔÎIJο¼£º
http://wiki.365linux.cn/index.php?doc-view-39
http://blog.csdn.net/lanmanck/archive/2009/11/05/4770030.aspx
work queueµÄÍ·Îļþ£º /kernel/include/linux/workqueue.h
work queueµÄÊý¾Ý½á¹¹£º
struct work_struct {
atomic_long_t data;
#define WORK_STRUCT_PENDING 0 /* T if work item pending execution */
#define WORK_STRUCT_FLAG_MASK (3UL)
#define WORK_STRUCT_WQ_DATA_MASK (~WORK_STRUCT_FLAG_MASK)
struct list_head entry;
work_func_t func;
#ifdef CONFIG_LOCKDEP
struct lockdep_map lockdep_map;
#endif
};
ÆäÖÐ work_func_t µÄ¶¨ÒåÈçÏ£º
typedef void (*work_func_t)(struct work_struct *work);
work queue Ö÷ÒªµÄ API£º
INIT_WORK(struct work_struct *work, work_func_t func)
INIT_DELAYED_WORK(struct delayed_work *work, work_func_t func)
int schedule_work(struct work_struct *work)
void flush_scheduled_work(void)
int schedule_delayed_work(struct delayed_work *work, unsigned long delay)
int cancel_delayed_work(struct delayed_work *work)
struct workqueue_struct *create_workqueue(const char *name)
int queue_work(struct workqueue_struct *wq, struct work_struct *work)
int queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *work, unsigned long delay)
void flush_workqueue(struct workqueue_struct *wq)
void destroy_workqueue(struct workqueue_struct *wq)
work queue µÄʹÓÃʵÀý£º
struct my_work_t {
ch
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
1. ѧ»áд¼òµ¥µÄmakefile
2. ±àһЩӦÓÃ
³ÌÐò
£¬¿ÉÒÔÓÃmakefileÅÜÆðÀ´
3. ѧ»áдÇý¶¯
µÄmakefile
4. дһ¼òµ¥charÇý¶¯£¬makefile±àÒëͨ¹ý£¬¿ÉÒÔinsmod£¬ lsmod£¬ rmmod. ÔÚÇý¶¯µÄinitº¯ÊýÀï´òÓ¡hello world£¬insmodºóÓ¦¸ÃÄܹ»Í¨¹ýdmesg¿´µ½Êä³ö
¡£
5. дһÍêÕûÇý¶¯£¬ ¼ÓÉÏread£¬ write£¬ ioctl£¬ pollingµÈ¸ ......
À´Ô´£ºhttp://www.168-net.com/program/newsnew/data/2005-03/20050325124716723.htm
·½°¸Ò»
±¾ÎÄÏêϸ½éÉÜrsync·þÎñµÄ°²×°ÅäÖÃÒÔ¼°ÈçºÎÀûÓÃrsync±£³ÖLinux·þÎñÆ÷¼äµÄÎļþͬ²½¡£
¡¡¡¡·þÎñÆ÷Ö®¼ä³£³£Òª±£³ÖЩÎļþ»òĿ¼µÄÒ»Ö£¬±ÈÈçһЩ´óµÄÈí¼þÏÂÔØÍøÕ¾£¬ËüÃÇͨ³£Ê¹Óöą̀·þÎñÆ÷À´ÌṩÏÂÔØ·þÎñ¡£µ±Ò»Ì¨·þÎñÆ÷ÉϵÄÎÄ ......
ÔÚWindwosÖУ¬ÏµÍ³Ê±¼äµÄÉèÖúܼòµ¥£¬½çÃæ²Ù×÷£¬Í¨Ë×Ò׶®¡£¶øÇÒÉèÖúó£¬ÖØÆô£¬¹Ø»ú¶¼Ã»¹Øϵ¡£ÏµÍ³Ê±¼ä»á×Ô¶¯±£´æÔÚBiosµÄʱÖÓÀïÃ棬Æô¶¯¼ÆËã»úµÄʱºò£¬ÏµÍ³»á×Ô¶¯ÔÚBiosÀïÃæÈ¡Ó²¼þʱ¼ä£¬ÒÔ±£Ö¤Ê±¼äµÄ²»¼ä¶Ï¡£ µ«ÔÚLinuxÏ£¬Ä¬ÈÏÇé¿öÏ£¬ÏµÍ³Ê±¼äºÍÓ²¼þʱ¼ä£¬²¢²»»á×Ô¶¯Í¬²½¡£ÔÚLinu ......
ÕªÒª£º LinuxÓû§°²×°Linux²Ù×÷ϵͳʱÓöµ½µÄÒ»¸ö×î³£¼ûµÄÄÑÒÔ¾ö¶¨µÄÎÊÌâ¾ÍÊÇÈçºÎÕýÈ·µØ¸øÆÀ¹À¸÷·ÖÇø´óС£¬ÒÔ·ÖÅäºÏÊʵÄÓ²Å̿ռ䡣¶øÓöµ½³öÏÖij¸ö·ÖÇø¿Õ¼äºÄ¾¡Ê±£¬½â¾öµÄ·½·¨Í¨³£ÊÇʹÓ÷ûºÅÁ´½Ó£¬»òÕßʹÓõ÷Õû·ÖÇø´óСµÄ¹¤¾ß(±ÈÈçPatition MagicµÈ)£¬µ«ÕⶼֻÊÇÔÝʱ½â¾ö°ì·¨£¬Ã»Óиù±¾½â¾öÎÊÌâ¡£Ëæ×ÅLinuxµÄÂß¼Å̾í¹ÜÀí¹¦ÄÜ ......