Calling ArkTS Functions from Non-ArkTS Threads in HarmonyOS
Module Registration
First, we need to register the native module. This is done in the queue_work.cpp file:
// queue_work.cpp
EXTERN_C_START
static napi_value Init(napi_env env, napi_value exports) {
napi_property_descriptor desc[] = {
{ "queueWork", nullptr, QueueWork, nullptr, nullptr, nullptr, napi_default, nullptr }
...
Posted on Fri, 21 Aug 2026 16:48:40 +0000 by Tonsil
Understanding uvw: A Modern C++ Wrapper for libuv
To begin, clone the repository or download the source directlly from GitHub. The entire library is header-only — all code resides in the src/ directory, primarily within uvw.hpp. To use it, simply include this header and link against libuv. Ensure your libuv version matches the one specified in uvw’s release tags.
Basic Server and Client Exampl ...
Posted on Fri, 24 Jul 2026 16:13:07 +0000 by php Newbie
Modern C++ Techniques in UVW: Templates and Scoped Enums
UVW, a modern C++ wrapper around libuv, leverages several advanced language features to provide type safety, performance, and expressive APIs. Two such features—templates and scoped enumerations (enum class)—play critical roles in its design.
Templates for Type-Safe Resource Management
Consider how UVW creates handles:
auto tcp = loop.resource& ...
Posted on Thu, 11 Jun 2026 16:41:16 +0000 by arn_php
Inside UVW’s Event Emitter: Design Decisions and C++11 Tricks
The header uvw/emitter.hpp is the beating heart of the UVW library: every resource inherits from the Emitter template to gain an event-driven interface. This article walks through the interesting language features and design choices that make the class tick.
Type-safe event IDs without an enum
Lines 161–185 contain a small but powerful metap ...
Posted on Wed, 13 May 2026 05:15:32 +0000 by BinaryBird