第一:linux系统中pthread_t定义
在linux中可以使用pthread_t来查看对应变量的定义
#include <pthread.h>
#include <unistd.h>
pthread_t;
/* Thread identifiers. The structure of the attribute type is not
exposed on purpose. */
typedef unsigned long int pthread_t;
总结:可以看到pthread_t 就是unsigned long int ,在本系统中占用8个字节
,即为uint64,打印线程ID需要用%lu格式。
第二: linux右上角键盘消失
如果用的是ibus:
1. 先把原先的ibus进程kill掉
killall ibus-daemon
2. 启动一个新的ibus进程
ibus-daemon -d
然后就可以看见键盘图标又出现在右上角了
如果使用的是fcitx的小企鹅输入法:
1. killall fcitx
2. fcitx -d
就看到右上角的输入法图标了
第三:linux内核下lcd屏幕自动休眠方法
临时解决方法一:echo 0 > /sys/class/graphics/fb0/blank
长期解决办法二:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
int fd;
fd = open("/dev/tty0",O_RDWR);
write(fd, “\033[9;0]”, 8);
close(fd);
return 0;
}
1.程序存为display_time.c
2 交叉编译 arm-linux-gcc -o display_time display_time.c
3.display_time复制到根目录下
4 运行 ./display_time
如果要开机自动启动,复制到根目录后,在/etc/init.d/rcS里加上一句 /display_time 。