自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(63)
  • 收藏
  • 关注

原创 2021-10-11日日日

m界面

2021-10-11 19:56:34 213

原创 git

git remote add test xxxxxgit fetch upstreamgit checkout xxxxxgit merge/pull upstream xxxxxgit push origin xxxxx

2021-09-30 16:59:33 96

转载 跟我一起写Makefile

https://seisman.github.io/how-to-write-makefile/overview.html

2021-09-04 16:56:27 111

原创 linux命令大全

https://man.linuxde.net/strace

2021-08-05 15:07:34 77

原创 android GPS

http://zenki2001cn.github.io/Wiki/Android/GPS%E7%9A%84HAL%E5%B1%82.html

2021-07-10 15:39:35 113 2

转载 ContentResolver基本用法

https://zhuanlan.zhihu.com/p/40146450

2021-06-26 17:28:54 146

转载 Android 同步机制解析

https://www.jianshu.com/p/698f2241c5ee?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

2021-06-26 16:36:32 110

原创 undefined referance to __android_log_print问题

#include <android/log.h>#include <cutils/log.h>LOCAL_LDLIBS := -lm -llogLOCAL_SHARED_LIBRARIES := \ libutils \ libbinder \ libhardware

2021-06-25 15:47:23 95

原创 shell 代替getopts选项

#!/bin/sh# POSIXdie() { printf '%s\n' "$1" >&2 exit 1}# Initialize all the option variables.# This ensures we are not contaminated by variables from the environment.file=verbose=0while :; do case $1 in -h|-\?|--help).

2021-06-18 11:17:36 110

原创 C/C++语言业界静态扫描工具

静态扫描工具:Pc-lint plusCoverityFortify代码度量(代码复杂度、重复度)simian

2021-06-18 11:15:37 271

原创 C++基础:模板与嵌套依赖类

#include <vector>#include <list>#include <iostream>using namespace std;template<typename Type = vector<int>> // 默认类型设定为vectorclass MyClass {private: Type m_data;public: MyClass(Type &data) : m_data(data).

2021-06-18 11:14:44 171

原创 Gallery2相关文件

frameworks/base/core/jni/android/graphics/BitmapRegionDecoder.cpp frameworks/base/core/jni/android/graphics/Graphics.cpp packages/apps/Gallery2/src/com/android/gallery3d/app/SinglePhotoDataAdapter.java package...

2021-06-09 10:54:13 513

原创 字符串资源

frameworks/base/tools/aapt/tests/plurals/res/values/strings.xmlhttps://developer.android.com/guide/topics/resources/string-resource?hl=zh-cnhttps://www.jianshu.com/p/186fb3de7b27

2021-06-09 10:49:09 63

原创 Android Gallery2源代码分析

https://www.cnblogs.com/yxysuanfa/p/7114810.html

2021-06-01 15:45:38 239

原创 SHELL —— grep命令+正则表达式

https://www.cnblogs.com/zihe/p/6933809.html

2021-05-27 18:42:53 64

原创 Notification框架简介

https://www.jianshu.com/p/4b9fb73762df

2021-05-27 18:41:22 98

原创 shell脚本速查

# 数值比较:# n1 -eq n2检查n1是否等于n2 # n1 -le n2检查n1是否小于等于n2# n1 -ge n2检查n1是否大于等于n2 # n1 -lt n2检查n1是否小于n2# n1 -gt n2检查n1是否大于n2 # n1 -ne n2检查n1是否不等于n2...

2021-05-24 11:30:09 79

原创 Android.mk速查

LOCAL_PATH:= $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE:= testLOCAL_SRC_FILES:= test.cinclude $(BULID_EXECUTABLE)# 模块生成目录LOCAL_MODULE_PATH := /lib/out # 当前路径下所有c文件LOCAL_ALL_FILES := $(call all-c-files-under)LOCAL_SRC_FILES := $(LO...

2021-05-19 08:59:09 181 1

原创 read函数阻塞还是非阻塞

read函数只是一个通用的读文件设备的接口。是否阻塞需要由设备的属性和设定所决定。1.一般来说,读字符终端、网络的socket描述字,管道文件等,这些文件的缺省read都是阻塞的方式。2.如果是读磁盘上的文件,一般不会是阻塞方式的。但使用锁和fcntl设置取消文件O_NOBLOCK状态,也会产生阻塞的read效果。...

2021-05-07 23:33:50 4307

原创 time-wait的作用

https://zhuanlan.zhihu.com/p/51961509

2021-02-28 21:35:07 106

原创 ASIO

http://think-async.com/

2021-02-27 16:26:09 111

原创 C++基础:内存一致性和多线程的关系

转载于知乎问题:https://www.zhihu.com/question/24301047其实多线程间代码本来就是各自执行各自的,这个和memory order是两个概念,memory order是针对单线程重排序规则的概念,概念本身可以不讲多线程。多线程只是利用了memory order的规则加内存一致性来做线程同步而已。因为概念混乱,1,2,3,4都不太对的感觉。第一点,relaxed,线程内不保证所有原子操作是顺序进行的,而是如其字面意思在不影响逻辑的条件下最大限度的重排序(relax

2021-02-26 21:58:36 300

原创 非线程安全系统函数

https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_09

2021-02-25 19:06:49 71

原创 C++编程实践:线程安全的单例模式

https://preshing.com/20130930/double-checked-locking-is-fixed-in-cpp11/http://www.voidcn.com/article/p-zdgudqdp-xt.html#include <iostream>#include <mutex>#include <atomic>#include <thread>class Singleton {private: ..

2021-02-23 17:40:18 123 1

原创 C++基础:std::enable_shared_from_this的作用

使用share_ptr管理自定义类型存在的问题​#include <memory>#include <iostream>class B{public: void func() { // 1.使用this裸指针进行共享指针的初始化 std::shared_ptr<B> local_sp_b(this); // 2.local_sp_b限定在作用域内,计数为1 std::cout &lt.

2021-02-21 21:45:42 346

原创 C++基础: shared_ptr<T>::reset 自定义删除器函数

class Base{public: ~Base() { std::cout << __FUNCTION__ << std::endl; } void Test(std::string name, int id) { std::shared_ptr<Base> sp(new Base()); // 1.reset函数的第二个参数需要为仅有一个Base指针参数的方法 // 2..

2021-02-21 19:24:59 721

原创 C++基础:weak_ptr初始化

#include <memory>#include <iostream>int main(){ // 1.shared_ptr直接赋值 std::shared_ptr<int> sp0(new int(10)); std::weak_ptr<int> wp1 = sp0; // 2.make_shared std::weak_ptr<int> wp2 = std::make_shared&l.

2021-02-20 23:54:53 770

原创 Cpp-Concurrency-in-Action 随书官方源码

https://github.com/bsmr-c-cpp/Cpp-Concurrency-in-Action

2021-02-20 20:31:26 189

原创 C++基础:智能指针share_ptr的初始化

// queue::front#include <memory>#include <iostream>int main (){ std::shared_ptr<int> sp1{new int(10)}; std::shared_ptr<int> sp2(new int(10)); std::shared_ptr<int> sp3 = std::make_shared<int>(10); std.

2021-02-20 17:11:38 593

原创 C++基础:伪共享(false sharing)

https://www.cnblogs.com/tong-yuan/p/FalseSharing.html

2021-02-20 17:06:50 667

原创 C++基础:shared_ptr 创建时即捕获析构

#include <iostream>using namespace std;class base{public: base(){cout << "base construct" << endl;} virtual void print(){cout << "base print" << endl;} ~base(){cout << "base destruct" << endl;}};.

2021-02-20 15:02:33 321

原创 C++基础:share_ptr与bind配合使用的引用计数陷阱

#include <iostream>#include <functional>class Foo {public: int doit() { return 10; }};int main() { std::shared_ptr<Foo> pFoo(new Foo); std::cout << pFoo.use_count() << std::endl; ...

2021-02-19 01:10:35 304

原创 C++11多线程基础:使用std::atomic_flag实现自旋锁

#include <atomic>#include <iostream>#include <thread>class spinlock_mutex{ std::atomic_flag flag;public: spinlock_mutex(): flag(ATOMIC_FLAG_INIT) {} void lock() { while(flag.test_and_set(std:.

2021-02-08 15:29:54 345

原创 C++基础:右值引用的汇编分析

https://www.cnblogs.com/likaiming/p/9045642.html

2021-02-04 20:32:29 235

原创 C++多线程基础: 并发条件变量std::condition_variable

#include <iostream> // std::cout#include <thread> // std::thread#include <mutex> // std::mutex, std::unique_lock#include <condition_variable> // std::condition_variablestd::mutex .

2021-01-28 21:08:36 123

原创 C++多线程基础:用std::promise在线程中接收需要的值

#include <vector>#include <thread>#include <future>#include <numeric>#include <iostream>#include <chrono>void accumulate(std::vector<int>::iterator first, std::vector<int>::iterator la.

2021-01-28 14:34:33 169

原创 C++多线程:使用packaged_task异步执行任务

#include <iostream> // std::cout#include <future> // std::packaged_task, std::future#include <chrono> // std::chrono::seconds#include <thread> // std::thread, std::this_thread::sleep_for// count down tak..

2021-01-27 23:57:39 103

原创 C++基础:委托构造函数

class MyClass {private: int m_data1; int m_data2; int m_data3; int m_data4; int m_data5;public: // 声明构造函数0 MyClass(); // 构造函数1 委托 构造函数2 进行构造 MyClass(int d1, int d2, int d3) : MyClass(d1, d2, d3, 0){} // 构造函数2 .

2021-01-26 22:44:18 91

原创 C++基础:类的默认特殊成员函数

C++ 中类的特殊成员函数(Special member functions)是指,在某些特定情况下,即使程序员没有定义,编译器也会定义的函数包括:默认构造函数(Default constructor)拷贝构造函数(Copy constructor)移动构造函数(Move Constrcutor)拷贝分配操作符重载(Copy assignment operator)移动分配操作符重载(Move assignment operator)析构函数(Destructor)...

2021-01-26 14:47:49 265 4

原创 C++多线程基础:std::async异步任务与返回

#include <future>#include <chrono>#include <iostream>int get_the_answer() { int ret = rand(); std::this_thread::sleep_for(std::chrono::milliseconds(10000)); return ret;}void do_other_stuff() { std::this_thread::slee.

2021-01-26 10:27:09 390

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除