Linux C notes (BOOK UNIX)
Chapter 1: Thread
① thread functions
1. pthread_self();
2. thread existing
you can get the value of rval_ptr just by pthread_join(pthread_t tht, void ** rval_ptr)
cancel a thread as the thread exits with PTHREAD_CANCELED in pthread_exit, this function only send a signal but not wait until the thread really exits
We can give a function to a thread with which the thread can invoke it when it exits. This
pthread_clean_push
These two functions must be in pairs in your function routines but not in the main function. And one thing should be mentioned as : the routine should not be returned but
pthread_detach(pthread_t tid)
4. Thread synchronization of thread
② thread. synchronics
pthread_mutex_t variable
pthread_mutex_destroy()
ii. Lock
pthread_mutex_trylock() return instantly
pthread_unlock()
pthread_rwlook_t
pthread_rwlock_init
pthread_rwlock_destroy
ii. Lock
pthread_rwlock_wrlook
pthread_rwlock_unlock
pthread_rwlock_tryrdlock
pthread_rwlock_trywrlock
3. Cond
i. initiation
pthread_cond_init(&pcndt, attr);
相关文档:
例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......
一:前言
最近在研究android的sensor driver,主要是E-compass,其中用到了Linux input子系统.在网上也看了很多这方面的资料,感觉还是这篇分析的比较细致透彻,因此转载一下以便自己学习,同时和大家分享!
(这篇博客主要是以键盘驱动为例的,不过讲解的是Linux Input Subsystem,可以仔细的研究一下!)
键盘驱动将检 ......
Linux diff与patch的深入分析
http://blog.csdn.net/vrix/archive/2009/08/25/4483906.aspx
diff的输出格式分为传统格式和统一格式
1)diff的传统格式输出.
############################################
cat before.txt
输出:
This is a line to be deleted
This is a line that will be changed
This is a line ......
原文网址:http://blog.chinaunix.net/u1/51562/showart_1341707.html
一:前言
RCU机制出现的比较早,只是在linux kernel中一直到2.5版本的时候才被采用.关于RCU机制,这里就不做过多的介绍了,网上有很多有关RCU介绍和使用的文档.请自行查阅.本文主要是从linux kernel源代码的角度.来分析RCU的实现.
在讨论RCU的实 ......