2310C++ callback to waiter

original This article uses metaprogramming technology to automatically adapt the callback interface function and convert it into a waiter object. Usage example: name callback {<!– –> Use schedule = list<function<empty()>>; NullAdd(Scheduling&_Scheduling, Int&&_a, Constant&_b, Double_c, Double_d, Function<null(Integer, Double)>_f){< !– –> _Scheduling.Original ([_f, x = _a + _b, y = _c + _d]{<!– –>_f(x, y);}); } empty […]

Mysql exception: Lock wait timeout exceeded; solution to try restarting transaction

Problem phenomenon The interface response time is too long, and it takes dozens of seconds to return an error message. The error Lock wait timeout exceeded; try restarting transaction appears in the background log. <– java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4120) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4052) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2503) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2664) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2794) […]

[Multi-threading] Thread control {thread creation, thread exception, program replacement in multi-threads; thread waiting, parameters and return values of thread entry functions; thread termination, thread ID, thread attribute structure, thread independent stack structure, thread local Variables; thread separation; pthread library functions}

1. Thread creation 1.1 pthread_create function The pthread_create() function is a function used to create threads. It belongs to the pthread thread library (POSIX thread library). The function prototype is as follows: #include <pthread.h> int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg); Parameter Description: thread: Pointer to pthread_t type, used to […]

Linux | Process termination and process waiting

Table of Contents Preface 1. Process termination 1. Several possibilities for process termination 2. exit and _exit 2. Process waiting 1. Why should the process wait? 2. How to wait for the process (1) wait function (2) waitpid function 3. Deeply understand process waiting again Foreword When we introduced the process earlier, we said that […]

Linux process control process creation, termination, waiting

()Hi! Hello, this is the homepage of ky233 ky233_-CSDN Blog First Introduction to Linux Process, C++ Classes and Objects, C++ Classes and Objects Part 1 https://blog.csdn.net/ky233?type=blog Please follow me to avoid getting lost?’?’? Table of Contents 1. Process creation 1. Understanding of fork function 1. Please describe what the operating system does when fork creates […]

Asynchronous iterator for-await-of

Asynchronous iterator for-await-of Iterator interface (iterator) Collection concepts include strings, arrays, objects, Maps, and Sets. There needs to be a unified interface mechanism to handle all different data structures. What Iterator iterator is an interface that provides a unified access mechanism for different data structures. Benefits Provide a unified and simple access interface for various […]

04 In-depth exploration of waitForService<ISurfaceComposer>

There is such a piece of code in the previous analysis of “Constructing surfaceComposerClient” bool ComposerService::connectLocked() { const String16 name(“SurfaceFlinger”); mComposerService = waitForService<ISurfaceComposer>(name); if (mComposerService == nullptr) { return false; // fatal error or permission problem } … … } waitForService, this article will take an in-depth look at its implementation. android12\frameworks\ ative\libs\binder\include\binder\IServiceManager.h template<typename INTERFACE> […]

2023.10.17 Use of wait and notify and understanding CountDownLatch

Table of Contents Introduction Usage of method Introducing an instance (wait version without parameters) wait method execution process wait and notify combined example wait version with parameters The difference between notify and notifyAll Classic examples Summary CountDownLatch Introduction The biggest problem with threads is preemptive execution and random scheduling Although thread scheduling in the kernel […]