Skip to content

Instantly share code, notes, and snippets.

View 27Cobalter's full-sized avatar

27Cobalter / Takumi Kondo 27Cobalter

View GitHub Profile
#ifndef SHARED_MUTEX_H
#define SHARED_MUTEX_H
#include <pthread.h>
#include <stdatomic.h>
// 共有メモリに配置する構造体
typedef struct {
pthread_mutex_t mutex; // プロセス間で共有される堅牢なミューテックス
atomic_uint ref_count; // 参照カウンタ
cobalt@teto⮀~⮀⮀
⮁⮁⮁ sudo perf bench mem memcpy -s 2GB -l 10
# Running 'mem/memcpy' benchmark:
# function 'default' (Default memcpy() provided by glibc)
# Copying 2GB bytes ...
26.870777 GB/sec
# function 'x86-64-unrolled' (unrolled memcpy() in arch/x86/lib/memcpy_64.S)
# Copying 2GB bytes ...
#include <chrono>
#include <condition_variable>
#include <cstdint>
#include <iostream>
#include <mutex>
#include <stop_token>
#include <thread>
auto main() -> int32_t {
std::mutex mut;
cmake_minimum_required(VERSION 3.22)
project(opencv_builder)
set(OPENCV_VERSION "4.11.0")
string(TOLOWER ${CMAKE_SYSTEM_NAME} lower_system_name)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} lower_system_processor)
set(CMAKE_TOOLCHAIN_FILE OFF)
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install/opencv-${OPENCV_VERSION}-${lower_system_name}-${lower_system_processor}")
#include <cstdint>
#include <print>
#include <string_view>
class A {
public:
static constexpr const char* Key1 = "Key1";
static inline const char* Key2 = "Key2";
static inline const char* const Key3 = "Key3";
};
cd $(git rev-parse --show-toplevel) | (cd build && ninja -t deps) | grep -E "^[ \t]" | grep -E "\.(cc|cpp|cxx|h|hpp|inl)$" | awk '!a[$0]++{print $0}' | sed -e "s/^[ \t]*//" -e "s@$(git rev-parse --show-toplevel)/@@g" | zip archive.zip -@