<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[君文]]></title><description><![CDATA[物竞天择，适者生存！]]></description><link>https://blog.youkuaiyun.com/l384011291</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; l384011291]]></copyright><item><title><![CDATA[主机不能ping通Vmware虚拟机，但是虚拟机能ping通主机的问题解决]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/112766161</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/112766161</guid><author>l384011291</author><pubDate>Mon, 18 Jan 2021 10:53:18 +0800</pubDate><description><![CDATA[在网上找了很多方法都不好使，没想到最后解决方法竟是如此简单！！以win7为例，到控制面板 - 网络和 Internet - 网络连接，先禁用VMnet8，然后再启用即可完美解决。
]]></description><category></category></item><item><title><![CDATA[线程同步之互斥锁]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/112442155</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/112442155</guid><author>l384011291</author><pubDate>Sun, 10 Jan 2021 21:29:58 +0800</pubDate><description><![CDATA[一、概述

互斥锁一般用于线程同步，其主要用于保护临界区，防止多个线程同时修改某些数据。互斥锁使用不当会造成死锁的情况，可能会导致程序卡死，这个需要开发者格外小心。



产生死锁的情况：

1、一个函数里面对一个互斥锁加锁之后，因为某个原因，没有解锁就结束了。比如：函数中没有解锁就return了。（对于这种情况我一般是使用goto替代return进行处理，就是在函数末尾设置一个标签，跳转至该标签会进行解锁操作）

2、多个线程多个互斥锁的情况，线程1对互斥锁A加锁，然后它试图访问线程2的资源，对互斥锁B.]]></description><category></category></item><item><title><![CDATA[error: unable to find string literal operator‘operator““str’with‘const char [8]’,‘long unsigned int’]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/111867965</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/111867965</guid><author>l384011291</author><pubDate>Mon, 28 Dec 2020 15:38:32 +0800</pubDate><description><![CDATA[定义以下打印宏的时候，C语言是可以编译通过的，
#define MyPrintf(str, args...) printf("[%s:%d]"str, __FUNCTION__, __LINE__, ##args)
而C++则会出现如下错误：
error: unable to find string literal operator‘operator""str’with‘const char [8]’,‘long unsigned int’arguments
解决方法是"[%s:%d]"和str之间加个空格]]></description><category></category></item><item><title><![CDATA[ubuntu更换源的方法]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/111597178</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/111597178</guid><author>l384011291</author><pubDate>Wed, 23 Dec 2020 19:22:40 +0800</pubDate><description><![CDATA[（1）备份原来的源，以防以后需要用到。

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

（2）打开/etc/apt/sources.list文件，用自己找到的源地址替换里面的内容，然后保存。

sudo vim /etc/apt/sources.list

在sources.list添加其他源的URL，比如阿里源(可以从https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102]]></description><category></category></item><item><title><![CDATA[关于Ubuntu使用vi编辑文件时按方向键会出现字符的解决方法]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/111597095</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/111597095</guid><author>l384011291</author><pubDate>Wed, 23 Dec 2020 19:18:24 +0800</pubDate><description><![CDATA[vmware新建虚拟机安装ubuntu后，这时候ubuntu里面使用的vim一般为vim-comm或vim-tiny，这会导致使用vi编辑文档时，按上下左右键会输出ABCD这些字母等，解决方法用两种：

（1）修改vim配置文件

打开配置文件/etc/vim/vimrc.tiny，将“set compatible”修改成“set nocompatible”，然后保存即可。（这里修改用vi打开，可以在非编辑模式下定位到对应修改的位置，再按i进入编辑模式进行修改）

（2）安装完整的vim（建议使用该方法，完]]></description><category></category></item><item><title><![CDATA[浅谈C语言的restrict关键字]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/106151509</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/106151509</guid><author>l384011291</author><pubDate>Fri, 15 May 2020 23:22:49 +0800</pubDate><description><![CDATA[restrict关键字用于告诉编译器，对象已经被指针所引用，不能通过除该指针外所有其他直接或间接的方式修改该对象的内容（并非强制性的规定，即用了其他指针访问该内存空间也不会报错）。注意，这是一个C语言的优化关键字，开发者需要自己在编码的时候注意只能使用该指针访问特定的内存空间，并且多个指针指向的空间也不能重叠，以便于编译器后期的优化。使用该关键字时一定要额外小心，不然会出现意想不到的BUG。



以下源码编译为汇编代码的时候使用了海思3519AV100的编译链arm-himix200-lin...]]></description><category></category></item><item><title><![CDATA[浅谈C语言的volatile关键字]]></title><link>https://blog.youkuaiyun.com/l384011291/article/details/106151308</link><guid>https://blog.youkuaiyun.com/l384011291/article/details/106151308</guid><author>l384011291</author><pubDate>Fri, 15 May 2020 23:06:56 +0800</pubDate><description><![CDATA[volatile用来提醒编译器它后面所定义的变量随时有可能改变，因此编译后的程序每次要对该变量进行操作时，都会对该变量的内存进行直接的操作，编译器不会自作主张地对变量进行优化。如果没有volatile关键字，则编译器可能优化读取和存储，可能暂时使用寄存器中的值，如果这个变量由别的代码更新了的话，将出现不一致的现象。



可以从下面的例子看出有没有加volatile的区别（PS：这里是使用了海思3519AV100的编译链arm-himix200-linux-以及加了-O1优化选项）：

1、没加volat.]]></description><category></category></item></channel></rss>