唤醒等待队列中的等待进程的函数wake_up()函数的核心实现函数是__wake_up_common()函数。__wake_up_common(wait_queue_head_t*q,intmode,intnr_exclusive,intwake_flags,void*key)参数介绍:q:是等待队列头;mode:是进程的状态模式其取值为:TASK_INTERRUPTIBLE,TASK_UNITERRUP..
分类:
其他好文 时间:
2014-10-23 06:51:54
阅读次数:
579
Implement strStr().Returns a pointer to the first occurrence of needle in haystack, ornullif needle is not part of haystack. 1 public class Solution {...
分类:
其他好文 时间:
2014-10-23 01:16:35
阅读次数:
220
1.1 dispatch_async(dispatch_get_global_queue(0, 0), ^{ 2 // 处理耗时操作的代码块... 3 4 //通知主线程刷新 5 dispatch_async(disp...
分类:
其他好文 时间:
2014-10-22 21:40:53
阅读次数:
270
Implement int sqrt(int x).
Compute and return the square root of x.
二分法,当无法求得准确值时,去较小值,(同时是最接近的)
public class Solution {
public int sqrt(int x) {
if(x<1) return 0;
int left = 1;
...
分类:
其他好文 时间:
2014-10-22 18:17:03
阅读次数:
228
队列头文件ngx_queue.h#include #include #ifndef _NGX_QUEUE_H_INCLUDED_#define _NGX_QUEUE_H_INCLUDED_typedef struct ngx_queue_s ngx_queue_t;// 队列的节点,也直接表示队列....
分类:
其他好文 时间:
2014-10-22 18:06:22
阅读次数:
235
Dispatch_queuedispatch_queue是一种执行处理的等待对列。按照追加顺序(FIFO)执行处理。dispatch_queue分为两种,一种是等待当前正在处理的任务完成后再执行下一个任务,每次只执行一个任务,按 照顺序执行,称为Serial Dispatch Queue,另一种就是...
分类:
其他好文 时间:
2014-10-22 17:29:49
阅读次数:
647
后台执行dispatch_async(dispatch_get_global_queue(0, 0), ^{ //后台程执行 something; }); 主线程执行dispatch_async(dispatch_get_main_queue(), ^{ // 主线程执行somethi...
分类:
其他好文 时间:
2014-10-22 15:50:05
阅读次数:
149
Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
get(key) - Get the value (will always be positive)
of the key if ...
分类:
系统相关 时间:
2014-10-22 12:56:02
阅读次数:
274
函数 dev_queue_xmit()用于直接使用sk_buf发包,此函数有返回值,但是并不能通过此函数返回值为0来说明包已经发送出去且可以立刻释放sk_buff内存。因为网卡发包是一个异步的过程,比如ixgbe网卡驱动发包过程可以查看此文。因此,解决办法是在skb_buff->uers没有减少的情...
分类:
其他好文 时间:
2014-10-22 12:49:51
阅读次数:
186
ngx_queue作为顺序容器链表,它优势在于其可以高效地执行插入、删除、合并操作,在插入删除的过程中,只需要修改指针指向,而不需要拷贝数据,因此,对于频繁修改的容器很适合。此外,相对于STL list,它还具有以下特点:
自身实现了排序功能
轻量级,不负责内存的分配
自身支持两个链表的合并...
分类:
其他好文 时间:
2014-10-22 10:07:12
阅读次数:
279