? A glib-like multi-platform c library

Overview

A glib-like cross-platform C library

Supporting the project

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. ? [Become a sponsor]

Introduction (中文)

TBOX is a glib-like cross-platform C library that is simple to use yet powerful in nature.

The project focuses on making C development easier and provides many modules (.e.g stream, coroutine, regex, container, algorithm ...), so that any developer can quickly pick it up and enjoy the productivity boost when developing in C language.

It supports the following platforms: Windows, Macosx, Linux, Android, iOS, *BSD and etc.

And it provides many compiling options using xmake:

  • Release: Disable debug information, assertion, memory checking and enable optimization.
  • Debug: Enable debug information, assertion, memory checking and disable optimization.
  • Small: Disable all extensional modules and enable space optimization.
  • Micro: compiling micro library (~64K) for the embed system.

If you want to know more, please refer to: Documents, Github and Gitee

Features

The stream library

  • Supports file, data, http and socket source
  • Supports the stream filter for gzip, charset and...
  • Implements stream transfer
  • Implements the static buffer stream for parsing data
  • Supports coroutine and implements asynchronous operation

The coroutine library

  • Provides high-performance coroutine switch
  • Supports arm, arm64, x86, x86_64 ..
  • Provides channel interfaces
  • Provides semaphore and lock interfaces
  • Supports io socket and stream operation in coroutine
  • Provides some io servers (http ..) using coroutine
  • Provides stackfull and stackless coroutines
  • Support epoll, kqueue, poll, select and IOCP
  • Support to wait pipe, socket and process in coroutine and poller at same time

The database library

  • Supports mysql and sqlite3 database and enumerates data using the iterator mode

The xml parser library

  • Supports DOM and SAX mode and Supports xpath

The serialization and deserialization library

  • Supports xml, json, bplist, xplist, binary formats

The memory library

  • Implements some memory pools for optimizing memory
  • Supports fast memory error detecting. it can detect the following types of bugs for the debug mode:
    • out-of-bounds accesses to heap and globals
    • use-after-free
    • double-free, invalid free
    • memory leaks

The container library

  • Implements hash table, single list, double list, vector, stack, queue and min/max heap. Supports iterator mode for algorithm

The algorithm library

  • Uses the iterator mode
  • Implements find, binary find and reverse find algorithm
  • Implements sort, bubble sort, quick sort, heap sort and insert sort algorithm
  • Implements count, walk items, reverse walk items, for_all and rfor_all

The network library

  • Implements dns(cached)
  • Implements ssl(openssl, polarssl, mbedtls)
  • Implements http
  • Implements cookies
  • Supports ipv4, ipv6
  • Supports coroutine

The platform library

  • Implements timer, fast and low precision timer
  • Implements atomic and atomic64 operation
  • Implements spinlock, mutex, event, semaphore, thread and thread pool
  • Implements file, socket operation
  • Implements poller using epoll, poll, select, kqueue ...
  • Implements switch context interfaces for coroutine

The charset library

  • Supports utf8, utf16, gbk, gb2312, uc2 and uc4
  • Supports big endian and little endian mode

The zip library

  • Supports gzip, zlibraw, zlib formats using the zlib library if exists
  • Implements lzsw, lz77 and rlc algorithm

The utils library

  • Implements base32, base64 encoder and decoder
  • Implements assert and trace output for the debug mode
  • Implements bits operation for parsing u8, u16, u32, u64 data

The math library

  • Implements random generator
  • Implements fast fixed-point calculation, Supports 6-bits, 16-bits, 30-bits fixed-point number

The libc library

  • Implements lightweight libc library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Implements strixxx strrxxx wcsixxx wcsrxxx interface extension
  • Optimizes some frequently-used interface, .e.g. memset, memcpy, strcpy ...
  • Implements memset_u16, memset_u32, memset_u64 extension interfaces

The libm library

  • Implements lightweight libm library interfaces, the interface name contains tb_xxx prefix for avoiding conflict
  • Supports float and double type

The regex library

  • Supports match and replace
  • Supports global/multiline/caseless mode
  • Uses pcre, pcre2 and posix regex modules

The hash library

  • Implements crc32, adler32, md5 and sha1 hash algorithm
  • Implements some string hash algorithms (.e.g bkdr, fnv32, fnv64, sdbm, djb2, rshash, aphash ...)
  • Implements uuid generator

Projects

Some projects using tbox:

Build

Please install xmake first: xmake

# build for the host platform
$ cd ./tbox
$ xmake

# build for the mingw platform
$ cd ./tbox
$ xmake f -p mingw --sdk=/home/mingwsdk
$ xmake

# build for the iphoneos platform
$ cd ./tbox
$ xmake f -p iphoneos
$ xmake

# build for the android platform
$ cd ./tbox
$ xmake f -p android --ndk=xxxxx
$ xmake

# build for the linux cross-platform
$ cd ./tbox
$ xmake f -p linux --sdk=/home/sdk # --bin=/home/sdk/bin
$ xmake

Example

#include "tbox/tbox.h"

int main(int argc, char** argv)
{
    // init tbox
    if (!tb_init(tb_null, tb_null)) return 0;

    // trace
    tb_trace_i("hello tbox");

    // init vector
    tb_vector_ref_t vector = tb_vector_init(0, tb_element_str(tb_true));
    if (vector)
    {
        // insert item
        tb_vector_insert_tail(vector, "hello");
        tb_vector_insert_tail(vector, "tbox");

        // dump all items
        tb_for_all (tb_char_t const*, cstr, vector)
        {
            // trace
            tb_trace_i("%s", cstr);
        }

        // exit vector
        tb_vector_exit(vector);
    }

    // init stream
    tb_stream_ref_t stream = tb_stream_init_from_url("http://www.xxx.com/file.txt");
    if (stream)
    {
        // open stream
        if (tb_stream_open(stream))
        {
            // read line
            tb_long_t size = 0;
            tb_char_t line[TB_STREAM_BLOCK_MAXN];
            while ((size = tb_stream_bread_line(stream, line, sizeof(line))) >= 0)
            {
                // trace
                tb_trace_i("line: %s", line);
            }
        }

        // exit stream
        tb_stream_exit(stream);
    }

    // wait
    tb_getchar();

    // exit tbox
    tb_exit();
    return 0;
}

Technical Support

We also provide paid technical support to help users quickly solve related problems. For details, please click the image link below:

Or you can also consider sponsoring us to get technical support services, [Become a sponsor]

Contacts

Comments
  • Thread Local Storage for iOS target below 9.0 issue

    Thread Local Storage for iOS target below 9.0 issue

    __thread 在iOS8上,SDK: Xcode 12.2,还是不支持.iOS9下是i386的模拟器不支持.可能需要重新考虑下方案了😂

    xmake f --hash=y --zip=y --coroutine=y --exception=y --object=y --xml=y --charset=y -p iphoneos -a armv7 --target_minver=8 --cxflags="-fembed-bitcode " --mxflags="-fembed-bitcode" --asflags="-fembed-bitcode"
    xmake p tbox
    
    error: src/tbox/coroutine/stackless/scheduler.c:59:8: error: thread-local storage is not supported for the current target
    
    improvement 
    opened by L1MeN9Yu 24
  • tbox 在向某款嵌入式linux平台移植,进行配置时报错

    tbox 在向某款嵌入式linux平台移植,进行配置时报错

    描述问题

    tbox工程移植嵌入式平台时,按照文档中进行配置时,报错。 tbox 版本信息: c log.txt ommit 0cdb41ee2f944466e4d69219922f2feb5b761514 (HEAD -> master, origin/master, origin/HEAD) Author: ruki [email protected] Date: Sat Aug 17 00:48:37 2019 +0800

    set process private data
    

    执行命令:xmake f -p cross --sdk=/home/esuny/soft/arm-2009q3/ --bin=/home/esuny/soft/arm-2009q3/bin --cross=arm-none-linux-gnueabi- -v -D

    错误信息

    见附件

    相关环境

    os: ubuntu-18.04 cross-tool: arm-none-linux-gnueabi-gcc -v Using built-in specs. Target: arm-none-linux-gnueabi Configured with: /scratch/julian/2009q3-respin-linux-lite/src/gcc-4.4/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --enable-extra-sgxxlite-multilibs --with-arch=armv5te --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=|ffreestanding|nostdlib:;:-funwind-tables} %{O2:%{!fno-remove-local-statics: -fremove-local-statics}} %{O:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}' --enable-languages=c,c++ --enable-shared --disable-lto --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q3-67' --with-bugurl=https://support.codesourcery.com/GNUToolchain/ --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-ppl=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --with-cloog=/scratch/julian/2009q3-respin-linux-lite/obj/host-libs-2009q3-67-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/julian/2009q3-respin-linux-lite/install/arm-none-linux-gnueabi/bin Thread model: posix gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67)

    请提供其他附加信息帮助我们诊断问题。

    improvement 
    opened by aseing-0 16
  • 编译出错   right shift count >= width of type

    编译出错 right shift count >= width of type

    mingw 64bit

    MINGW64_NT-10.0-17134 XXX 3.0.7-338.x86_64 2019-07-11 10:58 UTC x86_64 Msys

    • xmake.exe f -p mingw
    • xmake.exe build
    error: src\tbox\memory\../utils/bits.h:639:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      639 |     p[4] = (tb_byte_t)(x >> 32);
          |                          ^~
    src\tbox\memory\../utils/bits.h:640:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      640 |     p[5] = (tb_byte_t)(x >> 40);
          |                          ^~
    src\tbox\memory\../utils/bits.h:641:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      641 |     p[6] = (tb_byte_t)(x >> 48);
          |                          ^~
    src\tbox\memory\../utils/bits.h:642:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      642 |     p[7] = (tb_byte_t)(x >> 56);
          |                          ^~
    src\tbox\memory\../utils/bits.h: In function 'tb_bits_set_u64_be_inline':
    src\tbox\memory\../utils/bits.h:646:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
      646 |     p[0] = (tb_byte_t)(x >> 56);
          |                          ^~
    src\tbox\memory\../utils/bits.h:647:26: error: right shift count >= width of type [-Werror=shift-count-overflow]
    

    根据 x >> 32 断定 tb_uint64_t == ulong

    #if defined(TB_COMPILER_IS_MSVC)
    typedef __int64                     tb_int64_t;
    typedef unsigned __int64            tb_uint64_t;
    #elif (TB_CPU_BITSIZE == 64)
    typedef signed long                 tb_int64_t;
    typedef unsigned long               tb_uint64_t;
    #else
    typedef signed long long            tb_int64_t;
    typedef unsigned long long          tb_uint64_t;
    #endif
    

    在本机上 sizeof(ulong) == 4

    至少在本机上 TB_CPU_BITSIZE 并不能作为 long 宽度的判断方法

    opened by q962 14
  • 项目使用xmake依赖tbox,安装的时候会出现错误

    项目使用xmake依赖tbox,安装的时候会出现错误

    注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。

    描述问题

    项目使用xmake依赖tbox,安装的时候会出现错误

    期待的结果

    应该能安装成功

    错误信息

    运行错误信息:

    ` Executing task: xmake f -p mingw -a x86 -m release -o "d:\git\gcctest/build" < checking for mingw directory ... D:\i686-8.1.0-win32-dwarf-rt_v6-rev0\mingw32 note: try installing these packages (pass -y to skip confirm)? in xmake-repo: -> mbedtls 2.13.0 -> zlib 1.2.11 -> tbox v1.6.6 [charset:y, coroutine:y, object:y, zlib:y, hash:y, mbedtls:y, zip:y, xml:y, regex:y] please input: y (y/n)

    => download https://github.com/madler/zlib/archive/v1.2.11.tar.gz .. ok => install zlib 1.2.11 .. ok => download https://github.com/tboox/tbox/archive/v1.6.6.tar.gz .. ok => download https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.13.0.zip .. ok package(mbedtls) is being accessed by other processes, please waiting! => install mbedtls 2.13.0 .. ok => install tbox v1.6.6 .. failed if you want to get verbose errors, please see: -> C:\Users\CY\AppData\Local.xmake\cache\packages\2101\t\tbox\v1.6.6\installdir.failed\logs\install.txt error: install failed! `

    install.txt 文件内容

    assertion failed!

    相关环境

    我使用的是mingw编译

    经过测试 使用默认本机的windows vs2019 也编译不通过 install.txt 内容一样

    其他信息

    opened by a952135763 12
  • linux交叉编译出错

    linux交叉编译出错

    打算将tbox交叉编译到一个armv7-a平台,通过以下指令进行配置: xmake f -p linux --sdk=/home/lzb/ql-ol-sdk/ql-ol-crosstool/sysroots/x86_64-oesdk-linux/usr --bin=/home/lzb/ql-ol-sdk/ql-ol-crosstool/sysroots/x86_64-oesdk-linux/usr/bin/arm-oe-linux-gnueabi -a armv7-a -vD 最后的错误信息如下:

    checkinfo: ...amdir/core/sandbox/modules/import/core/tool/compiler.lua:88: @programdir/modules/core/tools/gcc.lua:466: In file included from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/platform.h:42:0,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/prefix.h:33,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/xml.h:28,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/tbox.h:29,
                     from /dev/shm/.xmake1000/200407/_2D8E3EFF80704C208C042254E4DF4860.c:2:
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_test_and_set_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:289:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
                          ^
    In file included from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/platform.h:42:0,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/prefix.h:33,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/xml.h:28,
                     from /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/tbox.h:29,
                     from /dev/shm/.xmake1000/200407/_2D8E3EFF80704C208C042254E4DF4860.c:2:
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_test_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:298:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
                          ^
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h: In function 'tb_atomic_flag_clear_explicit_generic':
    /home/lzb/.xmake/packages/t/tbox/dev/7305ea363a954a7fa564d89730e01183/include/tbox/xml/../platform/atomic.h:307:22: error: size of array '__tb_static_assert__' is negative
         tb_assert_static(sizeof(tb_atomic_flag_t) == sizeof(tb_atomic32_t));
    

    看提示是tb_atomic_flag_t和tb_atomic32_t长度不匹配,也就是arm是64bit的。

    #if __tb_has_feature__(c_atomic) && !defined(__STDC_NO_ATOMICS__)
    #   include "libc/atomic.h"
    #elif defined(TB_COMPILER_IS_GCC) \
            && defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
    #   include "compiler/gcc/atomic.h"
    #elif defined(TB_CONFIG_OS_WINDOWS)
    #   include "windows/atomic.h"
    #endif
    

    看了一下上面相关代码,应该就是这些include都没用到,最后要这个内联通用函数,但是这个函数也就只是32bit,导致出问题了。

    improvement 
    opened by eddylin83 12
  • ubuntu编译tbox cortoutine模块问题

    ubuntu编译tbox cortoutine模块问题

    @waruqi 在ubuntu下编译tbox启用coroutine时编译出错: [ 0%]: compiling.debug src/tbox/platform/arch/context.S error: cc1: 错误: unrecognized command line option ‘-fcolor-diagnostics’ 请问该怎么处理呢?

    improvement 
    opened by chenfuchen 10
  • 协程间 跨线程通信的一个问题

    协程间 跨线程通信的一个问题

    想利用多个核功能. 所以有多个线程.

    为了描述简单, 假设有两个线程,记为: A, B. 各有一个调度器. 记为: a_scheduler 和b_scheduler.

    A 负责从tcp服务器收数据,解码转为消息,交给线程B处理. (通过一个queue通信,有lock,和条件变量 cond) B 负责处理消息, 以及其它一些事情(比如定时输出系统状态等)

    问题是: B 和如何等待 A的消息 ? 代码如下:

    //A线程
    void A()
    {
        //...
        tb_coroutine_start(b_scheduler,a_recv_tcp_data,tb_null,0);
        tb_co_scheduler_loop(a_scheduler, , tb_true);
    }
    
    //A线程中的, 收数据协程.
    void a_recv_tcp_data(tb_cpointer_t priv)
    {
        while(1){
            data = recv_from_tcp();
            msg = decode(data);
    
            lock(); //线程锁
            queue.enqueue(msg); //放入队列.
            cond.wake_up();  // 通知执行.
            unlock();//线程锁
        }
    
    }
    
    
    
    void do_show_tick(tb_cpointer_t priv)
    {
        while(1)
        {
            tb_trace_i("tick...");
            tb_coroutine_sleep(10*1000);
        }
    
    }
    
    //问题就是这个函数该怎么写, 
    //版本1:cond.wait 会导致线程B被挂起.
    //tick, do_show_tick 不会被执行.
    
    void do_handle_msg(tb_cpointer_t priv)
    {
        lock();
        int cdn = queue.size(); 
        while(cdn == 0){
            cond.wait();
            cdn = queue.size();
        }
        unlock();
        //...
    }
    
    //版本 2. 
    //如果这样的话, do_handle_msg 是不是会被一直调用. 就像忙查一样? 
    
    void do_handle_msg(tb_cpointer_t priv)
    {
        while(1) {
            lock();
            int cdn = queue.size(); 
            unlock();
            if(cdn == 0){
                tb_coroutine_yield();//....
            }else{
                ..... //handle msg
           }
            
        }
        //...
    }
    
    void B()
    {
        ...
        tb_coroutine_start(b_scheduler,do_show_tick,tb_null,0);
        tb_co_scheduler_loop(b_scheduler, tb_true);
    }
    
    opened by wzy2687 10
  • 关于demo的sleep.c请教

    关于demo的sleep.c请教

    你好,大牛,tbox的demo源码的sleep.c执行后开始打印了:

     [demo]: [coroutine: 10]: count: 9, interval: 10 ms
     [demo]: [coroutine: 1000]: count: 9, interval: 10 ms
     [demo]: [coroutine: 2000]: count: 9, interval: 10 ms
     [demo]: [coroutine: 100]: count: 9, interval: 10 ms
     ...
    

    我刚开始接触协程请见谅,有个地方想不通:按我的理解遇到 tb_msleep 后协程切出去了,10 ms超时后其它的协程(100, 1000, 2000 )应该不会执行啊,不应该是 tb_msleep 到时间后才会往后走麽?

    bug 
    opened by xzzh999 9
  • Windows/MinGW compile errors

    Windows/MinGW compile errors

    Compiling tbox 1.6.3 on Windows with MinGW (GCC 7.3.0) via:

    xmake f -p mingw --cflags=-Wno-error=unknown-pragmas
    xmake
    ...
    [23%]: compiling.release src\tbox\libm\tanf.c
    [23%]: compiling.release src\tbox\libm\atan.c
    [23%]: compiling.release src\tbox\libc\string\strcat.c
    error: src\tbox\platform\windows\iocp_object.c:456:85: error: 'FILE_SKIP_COMPLETION_PORT_ON_SUCCESS' undeclared (first use in this function); did you mean 'IO_COMPLETION_ALL_ACCESS'?
                 if (tb_kernel32()->SetFileCompletionNotificationModes((HANDLE)clientfd, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS))
                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                         IO_COMPLETION_ALL_ACCESS
    src\tbox\platform\windows\iocp_object.c:456:85: note: each undeclared identifier is reported only once for each function it appears in
    src\tbox\platform\windows\iocp_object.c: In function 'tb_iocp_object_connect':
    src\tbox\platform\windows\iocp_object.c:544:117: error: 'FILE_SKIP_COMPLETION_PORT_ON_SUCCESS' undeclared (first use in this function); did you mean 'IO_COMPLETION_ALL_ACCESS'?
                         if (tb_kernel32()->SetFileCompletionNotificationModes((HANDLE)(SOCKET)tb_sock2fd(object->sock), FILE_SKIP_COMPLETION_PORT_ON_SUCCESS))
                                                                                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                                                         IO_COMPLETION_ALL_ACCESS
    
    

    Visual Studio 2015 compiles fine but that's not what i am looking for. Anything i missed? Thanks!

    improvement 
    opened by nkindt 8
  • Memory leak on demo asio_httpd

    Memory leak on demo asio_httpd

    Hello ! I just cloned tbox and build it, then when testing ./demo asio_httpd with httpress/ab and watching a task manager I can see how memory consumption only grows, keep running the command bellow and watch process memory usage:

    ab -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h
    
    or
    
    httpress -t 2 -n 100000 -c 2000 -k http://127.0.0.1:8080/tbox/config.h
    

    I tested with valgrind and it reports no memory leaks (same number of allocations/deallocations) when terminating the program normally (key press), so I think it's memory fragmentation or any pool attached to a connection that is not been released (but because maybe they are attached to a hierarchy of pools that are released at the end valgrind can not find anything).

    The system where it's running is a ubuntu 14.04 64bits.

    Cheers !

    opened by mingodad 8
  • 编译错误

    编译错误

    [ 37%]: compiling.release src/tbox/stream/impl/stream/sock.c
    error: src/tbox/memory/impl/../../prefix/assert.h:255:135: 错误:‘__a’ may be used uninitialized [-Werror=maybe-uninitialized]
      255 | #   define tb_assert_static(x)          do { typedef int __tb_static_assert__[(x)? 1 : -1]; __tb_volatile__ __tb_static_assert__ __a; tb_used_ptr((tb_cpointer_t)(tb_size_t)__a); } while(0)
          |                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/tbox/memory/impl/native_large_allocator.c:627:9: 附注:in expansion of macro ‘tb_assert_static’
      627 |         tb_assert_static(!(sizeof(tb_native_large_data_head_t) & (TB_POOL_DATA_ALIGN - 1)));
          |         ^~~~~~~~~~~~~~~~
    
    opened by zhufengning 7
  • 👋 Cross compile QNX version error :(

    👋 Cross compile QNX version error :(

    描述问题

    QNX交叉编译tbox库,按照手册中的交叉编译模块配置后编译不通过。

    期待的结果

    能顺利完成tbox QNX平台的交叉编译。

    详细描述

    1. 根据手册配置好交叉工具链 xmake f -p cross -a qnx700-a --sdk=/home/liyq/qnx700/host/linux/x86_64/usr --bin=/home/liyq/qnx700/host/linux/x86_64/usr/bin --cross=ntoaarch64- 运行log如下:
    checking for libc_wcscasecmp ... no
    checking for posix_getnameinfo ... no
    checking for posix_pthread_setaffinity_np ... no
    checking for bsd_flock ... no
    checking for systemv_semget ... no
    checking for libc_memcpy ... ok
    checking for posix_utimensat ... no
    checking for libc_fgetc ... ok
    checking for posix_stat64 ... no
    checking for libm_log2f ... ok
    checking for libc_wcsstr ... ok
    checking for posix_posix_spawnp ... ok
    checking for posix_posix_spawn_file_actions_addchdir_np ... no
    checking for libc_strlen ... ok
    checking for posix_getpagesize ... no
    checking for libc_strnlen ... ok
    checking for posix_getaddrinfo ... no
    checking for posix_mkfifo ... ok
    checking for libc_signal ... ok
    checking for posix_preadv ... no
    checking for posix_pthread_key_create ... ok
    checking for libc_gettimeofday ... ok
    checking for libm_acosf ... ok
    checking for posix_sysconf ... no
    checking for posix_epoll_create ... no
    checking for libc_strncat ... ok
    checking for libc_fgets ... ok
    checking for libc_wcsncpy ... ok
    checking for posix_poll ... ok
    checking for posix_fcntl ... no
    checking for posix_copyfile ... no
    checking for libm_fmodf ... ok
    checking for libc_ungetc ... ok
    checking for libm_pow ... ok
    checking for libc_kill ... no
    checking for libc_wcscpy ... ok
    checking for libc_strncmp ... ok
    checking for posix_gethostname ... no
    checking for libc_memset ... ok
    checking for libc_strchr ... ok
    checking for libc_wcslen ... ok
    checking for posix_pipe ... no
    checking for libc_wcscmp ... ok
    checking for libc_backtrace ... no
    checking for libm_atan ... ok
    checking for posix_execvp ... no
    checking for libm_atan2 ... ok
    checking for libm_sincosf ... no
    checking for libc_wcscasestr ... no
    checking for posix_gethostbyaddr ... ok
    checking for posix_sendfile ... no
    checking for libc_wcsncat ... ok
    checking for posix_sched_setaffinity ... no
    checking for libc_strncasecmp ... no
    checking for libm_powf ... ok
    checking for libc_strcat ... ok
    checking for libc_mbstowcs ... ok
    checking for libc_memmem ... no
    checking for libc_strncpy ... ok
    checking for posix_pthread_mutex_init ... ok
    checking for libm_acos ... ok
    checking for libc_wcsnlen ... no
    checking for posix_pwritev ... no
    checking for libc_wcstombs ... ok
    checking for libm_exp ... ok
    checking for posix_writev ... ok
    checking for libc_wcslcpy ... no
    checking for posix_pread64 ... no
    checking for posix_regexec ... ok
    checking for libc_localtime ... ok
    checking for posix_pthread_create ... ok
    checking for posix_fork ... no
    checking for libc_wcsncmp ... ok
    checking for posix_waitpid ... ok
    checking for posix_futimens ... no
    checking for posix_getdtablesize ... no
    checking for posix_lstat64 ... no
    checking for libc_mktime ... ok
    checking for posix_getifaddrs ... no
    checking for libm_atan2f ... ok
    checking for posix_pwrite64 ... no
    checking for libc_strcasestr ... no
    checking for valgrind_VALGRIND_STACK_REGISTER ... no
    checking for libc_gmtime ... ok
    checking for posix_pthread_getspecific ... ok
    checking for posix_readv ... ok
    checking for feature_anonymous_union ... ok
    checking for posix_select ... ok
    checking for libm_sqrt ... ok
    checking for libm_sin ... ok
    checking for libc_setlocale ... ok
    checking for libc_strlcpy ... no
    checking for posix_vfork ... no
    checking for libm_atanf ... ok
    checking for posix_execvpe ... no
    checking for libm_cosf ... ok
    checking for posix_dlopen ... ok
    checking for libc_strcasecmp ... no
    checking for libc_random ... no
    checking for posix_epoll_wait ... no
    checking for libm_sincos ... no
    checking for posix_fdatasync ... no
    checking for libc_sigsetjmp ... ok
    checking for posix_getrlimit ... ok
    checking for libc_fputc ... ok
    checking for posix_open ... no
    checking for libc_strstr ... ok
    checking for posix_sched_yield ... ok
    checking for posix_regcomp ... ok
    checking for posix_pthread_setspecific ... ok
    checking for libc_fwrite ... ok
    checking for libc_strcmp ... ok
    checking for libm_tanf ... ok
    checking for libm_log2 ... ok
    checking for posix_opendir ... ok
    checking for libc_fread ... ok
    checking for posix_pthread_key_delete ... ok
    checking for posix_socket ... ok
    checking for libm_expf ... ok
    checking for libc_wcsncasecmp ... no
    checking for libc_wcscat ... ok
    checking for posix_gethostbyname ... ok
    checking for libm_asin ... ok
    checking for libc_strcpy ... ok
    checking for libc_setjmp ... no
    checking for libm_sinf ... ok
    checking for posix_mmap ... ok
    checking for libm_fmod ... ok
    checking for libc_memmove ... ok
    checking for libc_fputs ... ok
    checking for posix_sem_init ... ok
    checking for wchar ... no
    checking for libm_tan ... ok
    checking for libc_srandom ... no
    checking for libm_sqrtf ... ok
    checking for systemv_semtimedop ... no
    checking for libc_memcmp ... ok
    checking for libm_cos ... ok
    checking for libc_strrchr ... ok
    checking for libm_asinf ... ok
    checking for posix_pipe2 ... no
    checking for keyword_thread_local ... no
    checking for keyword_thread ... no
    generating src/tbox/tbox.config.h.in ... ok
    

    q1:这一步的checking是在检查什么,checking for xxx ... no的模块要如何处理?

    1. 执行xmake编译报错
    [  0%]: ccache compiling.release src/tbox/libc/stdlib/mbstowcs.c
    [  0%]: ccache compiling.release src/tbox/hash/bkdr.c
    [  0%]: ccache compiling.release src/tbox/math/fixed16.c
    [  0%]: ccache compiling.release src/tbox/libc/impl/libc.c
    [  0%]: ccache compiling.release src/tbox/tbox.c
    [  0%]: ccache compiling.release src/tbox/math/impl/math.c
    [  0%]: ccache compiling.release src/tbox/math/random/linear.c
    [  0%]: ccache compiling.release src/tbox/libc/stdlib/wcstombs.c
    [  0%]: ccache compiling.release src/tbox/hash/adler32.c
    [  0%]: ccache compiling.release src/tbox/math/random/random.c
    [  0%]: ccache compiling.release src/tbox/math/int32.c
    [  0%]: ccache compiling.release src/tbox/hash/fnv32.c
    [  1%]: ccache compiling.release src/tbox/libc/stdlib/random.c
    [  1%]: ccache compiling.release src/tbox/libc/stdlib/stdlib.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/gmmktime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/time.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/mktime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/gmtime.c
    [  3%]: ccache compiling.release src/tbox/libc/misc/time/localtime.c
    [  3%]: ccache compiling.release src/tbox/libc/string/wcschr.c
    [  3%]: ccache compiling.release src/tbox/libc/string/wcscmp.c
    [  3%]: ccache compiling.release src/tbox/libc/string/strncpy.c
    [  3%]: ccache compiling.release src/tbox/libc/string/strcpy.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strdup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsicmp.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strrchr.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strchr.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsndup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsnicmp.c
    [  6%]: ccache compiling.release src/tbox/libc/string/strcat.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsdup.c
    [  6%]: ccache compiling.release src/tbox/libc/string/wcsnrstr.c
    [  8%]: ccache compiling.release src/tbox/libc/string/memmov.c
    [  8%]: ccache compiling.release src/tbox/libc/string/strlen.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsncat.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsncpy.c
    [  8%]: ccache compiling.release src/tbox/libc/string/strnrstr.c
    [  8%]: ccache compiling.release src/tbox/libc/string/wcsrstr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcslcpy.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/strnrchr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcslen.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcscpy.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/strnistr.c
    [ 10%]: ccache compiling.release src/tbox/libc/string/wcsrchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnirstr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcscat.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/memdup.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcsnirchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/wcsnirstr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strichr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnirchr.c
    [ 12%]: ccache compiling.release src/tbox/libc/string/strnchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/wcsirchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memmem.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/wcsnrchr.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memcpy.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/memcmp.c
    [ 14%]: ccache compiling.release src/tbox/libc/string/strnstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strnicmp.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/wcsnlen.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strncat.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strnlen.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/wcsstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strirchr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strstr.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/strndup.c
    [ 16%]: ccache compiling.release src/tbox/libc/string/memset.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/wcsichr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/stricmp.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/stristr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/wcsirstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strlcpy.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strrstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strirstr.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strcmp.c
    [ 19%]: ccache compiling.release src/tbox/libc/string/strnichr.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/wcsncmp.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/wcsistr.c
    [ 21%]: ccache compiling.release src/tbox/libc/string/strncmp.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/swprintf.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/printf_object.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/getchar.c
    [ 21%]: ccache compiling.release src/tbox/libc/stdio/vswprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/wputs.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/putchar.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/snprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/vsnprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/wprintf.c
    [ 23%]: ccache compiling.release src/tbox/libc/stdio/sprintf.c
    [ 25%]: ccache compiling.release src/tbox/libc/stdio/printf.c
    [ 25%]: ccache compiling.release src/tbox/libc/stdio/puts.c
    [ 25%]: ccache compiling.release src/tbox/utils/singleton.c
    [ 25%]: ccache compiling.release src/tbox/utils/trace.c
    [ 25%]: ccache compiling.release src/tbox/utils/lock_profiler.c
    [ 25%]: ccache compiling.release src/tbox/utils/dump.c
    [ 25%]: ccache compiling.release src/tbox/utils/url.c
    [ 28%]: ccache compiling.release src/tbox/utils/base64.c
    [ 28%]: ccache compiling.release src/tbox/utils/bits.c
    [ 28%]: ccache compiling.release src/tbox/utils/used.c
    [ 28%]: ccache compiling.release src/tbox/utils/base32.c
    [ 28%]: ccache compiling.release src/tbox/prefix/state.c
    [ 28%]: ccache compiling.release src/tbox/memory/large_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/native_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/static_allocator.c
    [ 28%]: ccache compiling.release src/tbox/memory/impl/static_fixed_pool.c
    [ 28%]: ccache compiling.release src/tbox/memory/impl/native_large_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/static_large_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/prefix.c
    [ 30%]: ccache compiling.release src/tbox/memory/impl/memory.c
    [ 30%]: ccache compiling.release src/tbox/memory/virtual_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/default_allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/allocator.c
    [ 30%]: ccache compiling.release src/tbox/memory/string_pool.c
    [ 31%]: ccache compiling.release src/tbox/memory/static_buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/queue_buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/small_allocator.c
    [ 31%]: ccache compiling.release src/tbox/memory/buffer.c
    [ 31%]: ccache compiling.release src/tbox/memory/fixed_pool.c
    [ 33%]: ccache compiling.release src/tbox/string/string.c
    [ 33%]: ccache compiling.release src/tbox/string/static_string.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/data.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/http.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/sock.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/filter.c
    [ 33%]: ccache compiling.release src/tbox/stream/impl/stream/file.c
    [ 35%]: ccache compiling.release src/tbox/stream/impl/filter/cache.c
    [ 35%]: ccache compiling.release src/tbox/stream/impl/filter/chunked.c
    [ 35%]: ccache compiling.release src/tbox/stream/static_stream.c
    [ 35%]: ccache compiling.release src/tbox/stream/filter.c
    [ 35%]: ccache compiling.release src/tbox/stream/transfer.c
    [ 37%]: ccache compiling.release src/tbox/stream/stream.c
    [ 37%]: ccache compiling.release src/tbox/network/cookies.c
    [ 37%]: ccache compiling.release src/tbox/network/ipaddr.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/date.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/status.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/method.c
    [ 37%]: ccache compiling.release src/tbox/network/impl/http/option.c
    [ 39%]: ccache compiling.release src/tbox/network/impl/network.c
    [ 39%]: ccache compiling.release src/tbox/network/url.c
    [ 39%]: ccache compiling.release src/tbox/network/http.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/cache.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/looker.c
    [ 39%]: ccache compiling.release src/tbox/network/dns/server.c
    [ 39%]: ccache compiling.release src/tbox/network/ipv4.c
    [ 41%]: ccache compiling.release src/tbox/network/ipv6.c
    [ 41%]: ccache compiling.release src/tbox/network/unixaddr.c
    [ 41%]: ccache compiling.release src/tbox/network/hwaddr.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/count.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/heap_sort.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/insert_sort.c
    [ 41%]: ccache compiling.release src/tbox/algorithm/rfind.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/rwalk.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/rfind_if.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/walk.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/predicate.c
    [ 43%]: ccache compiling.release src/tbox/algorithm/remove.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/bubble_sort.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/quick_sort.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/find_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/count_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/find.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/remove_first_if.c
    [ 45%]: ccache compiling.release src/tbox/algorithm/distance.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/remove_if.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/binary_find_if.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/binary_find.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/sort.c
    [ 47%]: ccache compiling.release src/tbox/algorithm/remove_first.c
    [ 47%]: ccache compiling.release src/tbox/container/circle_queue.c
    [ 47%]: ccache compiling.release src/tbox/container/iterator.c
    [ 47%]: ccache compiling.release src/tbox/container/hash_set.c
    [ 49%]: ccache compiling.release src/tbox/container/heap.c
    [ 49%]: ccache compiling.release src/tbox/container/array_iterator.c
    [ 49%]: ccache compiling.release src/tbox/container/hash_map.c
    [ 49%]: ccache compiling.release src/tbox/container/single_list.c
    [ 49%]: ccache compiling.release src/tbox/container/queue.c
    [ 49%]: ccache compiling.release src/tbox/container/list.c
    [ 49%]: ccache compiling.release src/tbox/container/stack.c
    [ 49%]: ccache compiling.release src/tbox/container/vector.c
    [ 51%]: ccache compiling.release src/tbox/container/priority_queue.c
    [ 51%]: ccache compiling.release src/tbox/container/single_list_entry.c
    [ 51%]: ccache compiling.release src/tbox/container/bloom_filter.c
    [ 51%]: ccache compiling.release src/tbox/container/list_entry.c
    [ 51%]: ccache compiling.release src/tbox/container/element/uint16.c
    [ 51%]: ccache compiling.release src/tbox/container/element/uint8.c
    [ 54%]: ccache compiling.release src/tbox/container/element/uint32.c
    [ 54%]: ccache compiling.release src/tbox/container/element/true.c
    [ 54%]: ccache compiling.release src/tbox/container/element/ptr.c
    [ 54%]: ccache compiling.release src/tbox/container/element/long.c
    [ 54%]: ccache compiling.release src/tbox/container/element/hash.c
    [ 54%]: ccache compiling.release src/tbox/container/element/null.c
    [ 54%]: ccache compiling.release src/tbox/container/element/mem.c
    [ 54%]: ccache compiling.release src/tbox/container/element/size.c
    [ 54%]: ccache compiling.release src/tbox/container/element/str.c
    [ 55%]: ccache compiling.release src/tbox/libm/impl/libm.c
    [ 55%]: ccache compiling.release src/tbox/libm/idivi8.c
    [ 55%]: ccache compiling.release src/tbox/libm/ilog2i.c
    [ 57%]: ccache compiling.release src/tbox/libm/isqrti.c
    [ 57%]: ccache compiling.release src/tbox/libm/isqrti64.c
    [ 57%]: ccache compiling.release src/tbox/libm/cosf.c
    [ 57%]: ccache compiling.release src/tbox/libm/isinf.c
    [ 57%]: ccache compiling.release src/tbox/libm/exp.c
    [ 57%]: ccache compiling.release src/tbox/libm/sincos.c
    [ 57%]: ccache compiling.release src/tbox/libm/log2f.c
    [ 57%]: ccache compiling.release src/tbox/libm/log2.c
    [ 57%]: ccache compiling.release src/tbox/libm/expi.c
    [ 59%]: ccache compiling.release src/tbox/libm/expif.c
    [ 59%]: ccache compiling.release src/tbox/libm/sinf.c
    [ 59%]: ccache compiling.release src/tbox/libm/exp1f.c
    [ 59%]: ccache compiling.release src/tbox/libm/atanf.c
    [ 59%]: ccache compiling.release src/tbox/libm/isnan.c
    [ 59%]: ccache compiling.release src/tbox/libm/expf.c
    [ 62%]: ccache compiling.release src/tbox/libm/exp1.c
    [ 62%]: ccache compiling.release src/tbox/libm/isnanf.c
    [ 62%]: ccache compiling.release src/tbox/libm/cos.c
    [ 62%]: ccache compiling.release src/tbox/libm/atan2f.c
    [ 62%]: ccache compiling.release src/tbox/libm/tan.c
    [ 62%]: ccache compiling.release src/tbox/libm/fmodf.c
    [ 62%]: ccache compiling.release src/tbox/libm/atan.c
    [ 62%]: ccache compiling.release src/tbox/libm/sincosf.c
    [ 62%]: ccache compiling.release src/tbox/libm/isfinf.c
    [ 63%]: ccache compiling.release src/tbox/libm/tanf.c
    [ 63%]: ccache compiling.release src/tbox/libm/powf.c
    [ 63%]: ccache compiling.release src/tbox/libm/isinff.c
    [ 63%]: ccache compiling.release src/tbox/libm/asinf.c
    [ 65%]: ccache compiling.release src/tbox/libm/acos.c
    [ 65%]: ccache compiling.release src/tbox/libm/isfin.c
    [ 65%]: ccache compiling.release src/tbox/libm/pow.c
    [ 65%]: ccache compiling.release src/tbox/libm/asin.c
    [ 65%]: ccache compiling.release src/tbox/libm/sqrt.c
    [ 65%]: ccache compiling.release src/tbox/libm/sin.c
    [ 65%]: ccache compiling.release src/tbox/libm/atan2.c
    [ 66%]: ccache compiling.release src/tbox/libm/sqrtf.c
    [ 66%]: ccache compiling.release src/tbox/libm/acosf.c
    [ 66%]: ccache compiling.release src/tbox/libm/fmod.c
    [ 66%]: ccache compiling.release src/demo/demo.c
    [ 69%]: ccache compiling.release src/demo/libc/wcstombs.c
    [ 69%]: ccache compiling.release src/demo/libc/mbstowcs.c
    [ 69%]: ccache compiling.release src/demo/libc/wchar.c
    [ 69%]: ccache compiling.release src/demo/libc/time.c
    [ 69%]: ccache compiling.release src/demo/libc/string.c
    [ 69%]: ccache compiling.release src/demo/libc/stdlib.c
    [ 69%]: ccache compiling.release src/demo/libm/integer.c
    [ 69%]: ccache compiling.release src/demo/math/random.c
    [ 69%]: ccache compiling.release src/demo/utils/dump.c
    [ 69%]: ccache compiling.release src/demo/utils/url.c
    [ 71%]: ccache compiling.release src/demo/utils/base64.c
    [ 71%]: ccache compiling.release src/demo/utils/bits.c
    [ 71%]: ccache compiling.release src/demo/utils/base32.c
    [ 71%]: ccache compiling.release src/demo/other/test.c
    [ 71%]: ccache compiling.release src/demo/string/string.c
    [ 71%]: ccache compiling.release src/demo/string/static_string.c
    [ 73%]: ccache compiling.release src/demo/memory/check.c
    [ 73%]: ccache compiling.release src/demo/memory/large_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/impl/static_fixed_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/default_allocator.c
    [ 73%]: ccache compiling.release src/demo/memory/string_pool.c
    [ 73%]: ccache compiling.release src/demo/memory/static_buffer.c
    [ 73%]: ccache compiling.release src/demo/memory/queue_buffer.c
    [ 76%]: ccache compiling.release src/demo/memory/small_allocator.c
    [ 76%]: ccache compiling.release src/demo/memory/memops.c
    [ 76%]: ccache compiling.release src/demo/memory/buffer.c
    [ 76%]: ccache compiling.release src/demo/memory/fixed_pool.c
    [ 76%]: ccache compiling.release src/demo/platform/pipe_pair.c
    [ 76%]: ccache compiling.release src/demo/platform/ifaddrs.c
    [ 76%]: ccache compiling.release src/demo/platform/hostname.c
    [ 76%]: ccache compiling.release src/demo/platform/cache_time.c
    [ 76%]: ccache compiling.release src/demo/platform/thread.c
    [ 76%]: ccache compiling.release src/demo/platform/fwatcher.c
    [ 76%]: ccache compiling.release src/demo/platform/ltimer.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_fwatcher.c
    [ 78%]: ccache compiling.release src/demo/platform/addrinfo.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_pipe.c
    [ 78%]: ccache compiling.release src/demo/platform/poller_process.c
    [ 79%]: ccache compiling.release src/demo/platform/process.c
    [ 79%]: ccache compiling.release src/demo/platform/utils.c
    [ 79%]: ccache compiling.release src/demo/platform/stdfile.c
    [ 79%]: ccache compiling.release src/demo/platform/backtrace.c
    [ 79%]: ccache compiling.release src/demo/platform/atomic.c
    [ 79%]: ccache compiling.release src/demo/platform/lock.c
    [ 81%]: ccache compiling.release src/demo/platform/atomic64.c
    [ 81%]: ccache compiling.release src/demo/platform/atomic32.c
    [ 81%]: ccache compiling.release src/demo/platform/thread_pool.c
    [ 81%]: ccache compiling.release src/demo/platform/poller_server.c
    [ 81%]: ccache compiling.release src/demo/platform/environment.c
    [ 81%]: ccache compiling.release src/demo/platform/filelock.c
    [ 83%]: ccache compiling.release src/demo/platform/timer.c
    [ 83%]: ccache compiling.release src/demo/platform/file.c
    [ 83%]: ccache compiling.release src/demo/platform/path.c
    [ 83%]: ccache compiling.release src/demo/platform/sched.c
    [ 83%]: ccache compiling.release src/demo/platform/directory.c
    [ 84%]: ccache compiling.release src/demo/platform/semaphore.c
    [ 84%]: ccache compiling.release src/demo/platform/event.c
    [ 84%]: ccache compiling.release src/demo/platform/poller_client.c
    [ 84%]: ccache compiling.release src/demo/platform/thread_local.c
    [ 84%]: ccache compiling.release src/demo/platform/named_pipe.c
    [ 84%]: ccache compiling.release src/demo/container/circle_queue.c
    [ 87%]: ccache compiling.release src/demo/container/hash_set.c
    [ 87%]: ccache compiling.release src/demo/container/heap.c
    [ 87%]: ccache compiling.release src/demo/container/hash_map.c
    [ 87%]: ccache compiling.release src/demo/container/single_list.c
    [ 87%]: ccache compiling.release src/demo/container/queue.c
    [ 87%]: ccache compiling.release src/demo/container/list.c
    [ 87%]: ccache compiling.release src/demo/container/stack.c
    [ 87%]: ccache compiling.release src/demo/container/vector.c
    [ 89%]: ccache compiling.release src/demo/container/single_list_entry.c
    [ 89%]: ccache compiling.release src/demo/container/bloom_filter.c
    [ 89%]: ccache compiling.release src/demo/container/list_entry.c
    [ 89%]: ccache compiling.release src/demo/algorithm/find.c
    [ 89%]: ccache compiling.release src/demo/algorithm/sort.c
    [ 89%]: ccache compiling.release src/demo/stream/stream.c
    [ 66%]: ccache compiling.release src/demo/other/test.cpp
    [ 90%]: ccache compiling.release src/demo/stream/stream/cache.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/charset.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/zip.c
    [ 90%]: ccache compiling.release src/demo/stream/stream/null.c
    [ 90%]: ccache compiling.release src/demo/network/cookies.c
    [ 92%]: ccache compiling.release src/demo/network/ping.c
    [ 92%]: ccache compiling.release src/demo/network/unix_echo_client.c
    [ 92%]: ccache compiling.release src/demo/network/ipaddr.c
    [ 92%]: ccache compiling.release src/demo/network/impl/date.c
    [ 92%]: ccache compiling.release src/demo/network/dns.c
    [ 92%]: ccache compiling.release src/demo/network/url.c
    [ 92%]: ccache compiling.release src/demo/network/unix_echo_server.c
    [ 93%]: ccache compiling.release src/demo/network/http.c
    [ 93%]: ccache compiling.release src/demo/network/ipv4.c
    [ 93%]: ccache compiling.release src/demo/network/ipv6.c
    [ 93%]: ccache compiling.release src/demo/network/unixaddr.c
    [ 95%]: ccache compiling.release src/demo/network/whois.c
    [ 95%]: ccache compiling.release src/demo/network/hwaddr.c
    [ 95%]: ccache compiling.release src/demo/math/fixed.c
    [ 95%]: ccache compiling.release src/demo/libm/float.c
    [ 95%]: ccache compiling.release src/demo/libm/double.c
    [ 98%]: archiving.release libtbox.a
    [ 99%]: linking.release demo
    error: /home/liyq/qnx700/host/linux/x86_64//usr/bin/aarch64-unknown-nto-qnx7.0.0-ld: cannot find -lpthread
    /home/liyq/qnx700/host/linux/x86_64//usr/bin/aarch64-unknown-nto-qnx7.0.0-ld: cannot find -ldl
    collect2: error: ld returned 1 exit status
    

    q2:lpthread、ldl等库是否需要用交叉工具链编译相应平台的so库放入指定的目录(shared)才可以?

    相关环境

    ubuntu x86_64上 编译 qnx700

    交叉编译工具链目录结构:

    • lib
    • bin
    • shared
    • include
    opened by sitJac 1
  • sqlite3 demo get wrong row size

    sqlite3 demo get wrong row size

    Note: If you use the fuzzy expressions such as 'can't use/no effect/problem/error', but don't give any relevant auxiliary information according to the template below, this issue will be not replied.

    Describe the bug

    A clear and concise description of what the bug is. run

    xmake f -m debug -p macosx --database=y --sqlite3=y
    xmake
    xmake run demo database_sql ./test.db
    

    get wrong row size as follow:

    [demo]: ==============================================================================
    [demo]: row: size: 18446744073709551615
    [demo]: [row: 0, col: size: 9]: [id:1] [fval:3.000000] [name:name1] [data:data1] [tdata:ldata1] [ldata1:tdata1] [ldata2:null] [number:52642] [snumber:2642] 
    [demo]: [row: 1, col: size: 9]: [id:2] [fval:3.099999] [name:name2] [data:data2] [tdata:ldata2] [ldata1:tdata2] [ldata2:null] [number:57127] [snumber:7127] 
    [demo]: [row: 2, col: size: 9]: [id:3] [fval:3.140000] [name:name3] [data:data3] [tdata:ldata3] [ldata1:tdata3] [ldata2:null] [number:9000] [snumber:9000] 
    [demo]: [row: 3, col: size: 9]: [id:4] [fval:3.141499] [name:name4] [data:data4] [tdata:ldata4] [ldata1:tdata4] [ldata2:null] [number:29000] [snumber:9000] 
    [demo]: [row: 4, col: size: 9]: [id:5] [fval:-3.099999] [name:name5] [data:data5] [tdata:ldata5] [ldata1:tdata5] [ldata2:null] [number:350000] [snumber:5000] 
    [demo]: [row: 5, col: size: 9]: [id:6] [fval:3.453999] [name:name6] [data:data6] [tdata:ldata6] [ldata1:tdata6] [ldata2:null] [number:21000] [snumber:1000] 
    [demo]: [row: 6, col: size: 9]: [id:7] [fval:100.097999] [name:name7] [data:data7] [tdata:ldata7] [ldata1:tdata7] [ldata2:null] [number:21600] [snumber:1600] 
    [tbox]: [database]: exit: ..
    [tbox]: [database]: exit: ok
    

    Related Environment

    macOS Monterey 12.3.1 Xcode 13.4.1 tbox 1.6.8 xmake 2.6.9

    opened by suihanhbr 1
  • Add cgi support

    Add cgi support

    Is your feature request related to a problem? Please describe.

    no, just cgi with c

    Describe the solution you'd like

    use tbox to write simple cgi programs in c, similar to qdecoder, libcgi,cgic

    Describe alternatives you've considered

    qdecoder,libcgi,cgic

    Additional context

    Add any other context or screenshots about the feature request here.

    opened by laoshaw 0
  • json 数据解析浮点数错误

    json 数据解析浮点数错误

    注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。

    描述问题

    我使用如下的 json 串解码,得到的 confidence 字段一个是0.000000,另一个是0.750000。都不对。 [{"confidence":0.974220335483551,"text":"lenovo联想","text_region":[[191,80],[672,80],[672,148],[191,148]]},{"confidence":0.6968730688095093,"text":"BY:花享湖月","text_region":[[250,866],[332,866],[332,885],[250,885]]}]

    期待的结果

    如果是 debug 希望老大处理一下,如果是我使用错误,请老大指正一下。

    错误信息

    我以为是中文的问题,但我转换为 \uxxxx 格式后提示我需要重新编译启用 unicode 支持,那不是就说明不是中文的问题

    相关环境

    xmake v2.6.4+dev.35fa885 tbox master

    其他信息

    请提供其他附加信息帮助我们诊断问题。

    opened by huye 2
  • TB_OPTION_MODE_KEY_VAL  = 3  选项处理有错误

    TB_OPTION_MODE_KEY_VAL = 3 选项处理有错误

    注:提问题时若使用不能用/没效果/有问题/报错此类模糊表达,但又没有根据下面的模板给出任何相关辅助信息的,将绝对不会有任何反馈。

    描述问题

    看源码注释是:TB_OPTION_MODE_KEY_VAL = 3 //!< --key=value or --key value or -k=value or -k value 但经过我测试只有 --key=value 和 -k=value 才行,另外两个不行!

    我代码中的选项定义是这样的: c {'c', "config", TB_OPTION_MODE_KEY_VAL, TB_OPTION_TYPE_CSTR, "配置文件路径,支持 json/xml 等格式"},

    期待的结果

    -c=xxx 正常, -c xxx 报错

    错误信息

    [tbox]: [option]: [error]: aiden: no option value '--c=' at tb_option_done(): 465, src/tbox/utils/option.c

    相关环境

    xmake v2.6.4+dev.35fa885

    其他信息

    xmake 中的依赖:

    add_requires("tbox master", { configs = {database = true, object = true}, debug = is_mode("debug") })

    opened by huye 3
Releases(v1.7.2)
  • v1.7.2(Dec 28, 2022)

    New features

    • #201: Add xmake.sh

    Changes

    • Improve path for windows, support UNC and dos device path

    Bugs Fixed

    • #199: Fix tb_strcmp

    新特性

    • #201: 添加 xmake.sh

    改进

    • 改进 windows 下根路径处理,支持 UNC 和 dos 设备路径格式

    Bugs 修复

    • #199: 修复 tb_strcmp
    Source code(tar.gz)
    Source code(zip)
  • v1.7.1(Sep 22, 2022)

    New features

    • #190: Add fs watcher
    • Add tb_file_touch api

    Changes

    • Support wasm
    • Support arm64 for windows
    • Improve tb_file_info to detect symlink
    • Improve tb_file_copy to support symlink
    • Improve tb_directory_copy to support symlink

    新特性

    • #190: 添加文件系统状态监视器
    • 添加 tb_file_touch 接口

    改进

    • 支持 wasm
    • 支持 arm64 windows
    • 改进 tb_file_info,支持判断符号链接
    • 改进 tb_file_copy 支持符号链接
    • 改进 tb_directory_copy 支持符号链接
    Source code(tar.gz)
    Source code(zip)
  • v1.6.9(Jun 17, 2022)

    Changes

    • Improve bloom filter
    • Improve random for msvc

    Bugs Fixed

    • #187: Fix sort and iterator bug

    改进

    • 改进 bloom filter
    • 改进 windows/msvc 下 random 实现

    Bugs 修复

    • #187: 修复排序和迭代器问题
    Source code(tar.gz)
    Source code(zip)
  • v1.6.8(May 3, 2022)

    Changes

    • Add riscv32/riscv64/sh4/sparc support
    • Improve path support
    • Add peer name for socket

    Bugs Fixed

    • #178: Fix coroutine on windows/x86

    改进

    • 添加 riscv32/riscv64/sh4/sparc 架构支持
    • 改进路径支持
    • 为 socket 添加 peer name 接口

    Bugs 修复

    • #178: 修复协程在 windows/x86 上栈溢出问题
    Source code(tar.gz)
    Source code(zip)
  • v1.6.7(Nov 8, 2021)

    Changes

    • Support coroutine for mingw
    • Improve process poller to support to wait more processes on windows

    Bugs Fixed

    • #175: Fix coroutine crash on windows
    • Fix some compilation errors

    改进

    • 改进协程,增加对 mingw 支持
    • 改进 process poller 支持在 windows 上等待更多进程

    Bugs 修复

    • #175: 修复协程在 windows 上崩溃
    • 修复一些编译问题
    Source code(tar.gz)
    Source code(zip)
  • v1.6.6(Jan 21, 2021)

    New features

    • Support *BSD system, e.g. FreeBSD ..

    Changes

    • Support to change the current directory for process
    • Support stdin for creating process
    • Fix some compilation errors for mingw

    新特性

    • 支持*BSD系统,例如:FreeBSD

    改进

    • 创建进程支持修改处理当前工作目录
    • 创建禁止支持 stdin 重定向输入
    • 修复一些 mingw 上的编译错误
    Source code(tar.gz)
    Source code(zip)
  • v1.6.5(Feb 29, 2020)

    New features

    • #112: Support unix socket,thanks @Codehz
    • Support to wait pipe, socket and process in coroutine and poller at same time

    Changes

    • improve uuid and improve uuid v4
    • support msys/mingw and cygwin/gcc toolchains

    新特性

    • #112: 新增unix socket支持,感谢@Codehz的贡献
    • 在协程和poller中支持同时等待和调度socket,pipe io和process

    改进

    • 改进uuid生成,实现uuid v4
    • 支持msys/mingw和cygwin/gcc上编译
    Source code(tar.gz)
    Source code(zip)
  • v1.6.4(Oct 11, 2019)

    New features

    • #70: Add tb_stream_init_from_sock_ref() to open a given socket as stream
    • Add stdfile api to read/write stdin, stdout and stderr.
    • #81: Add set/get thread/process cpu affinity
    • Add filelock api
    • Add anonymous and named pipe

    Changes

    • Optimize queue_buffer module
    • Improve stream interfaces
    • Improve charset encoding and add ANSI support
    • Improve atomic and add c11-like atomic apis
    • Improve spinlock
    • Support to redirect process output to pipe
    • Uses virtual memory for coroutine stack
    • Improve openssl/mbedtls for https

    新特性

    • #70: 添加tb_stream_init_from_sock_ref()接口去直接打开一个socket作为stream去读取数据。
    • 添加stdfile接口去读写stdin, stdout和stderr。
    • #81: 添加对进程和线程的cpu亲缘性设置和获取
    • 添加filelock文件锁跨平台api接口
    • 添加匿名管道,命名管道支持

    改进

    • 优化queue_buffer模块
    • 改进stream接口实现
    • 改进字符集编码转换,以及增加对ANSI编码的支持
    • 改进原子操作,并增加c11风格原子接口
    • 改进spinlock实现
    • 新增进程输出重定向到管道
    • 针对协程栈使用虚拟内存
    • 改进基于openssl/mbedtls的https访问
    Source code(tar.gz)
    Source code(zip)
  • v1.6.3(Aug 1, 2018)

    New features

    • #24: Support IOCP for coroutine on windows

    Changes

    • Move docs directory to tbox-docs repo
    • Support tinyc compiler
    • Remove deprecated module (asio), please use coroutine module
    • Improve memory for container
    • Help valgrind to understand coroutines

    Bugs fixed

    • Fix the charset problem of envirnoment variables
    • Fix process exit bug
    • Fix setenv empty value crash
    • Fix coroutine.sleep bug
    • Fix windows root path bug
    • Fix thread local memory leak
    • Fix context bug for coroutine
    • Fix tb_vsnprintf overflow
    • #43: Fix read dns server and stream bug

    新特性

    • #24: 针对windows平台下的协程处理,增加IOCP支持

    改进

    • 移除docs目录,放置到独立tbox-docs仓库,减少tbox.zip包大小
    • 支持tinyc编译器
    • 移除被废弃的模块(asio模块,先用coroutine代替)
    • 精简优化容器库内存资源使用
    • 帮助valgrind更好的理解coroutine

    Bugs修复

    • 修复windows环境变量的中文编码问题
    • 修复后台进程退出问题
    • 修复设置环境变量值为空时的崩溃问题
    • 修复协程sleep超时覆写数据的bug
    • 修复windows根路径问题
    • 修复tls线程存储内存泄露问题
    • 修复context切换问题
    • 修复tb_vsnprintf栈溢出问题
    • #43: 修复读取dns服务器以及stream读取bug
    Source code(tar.gz)
    Source code(zip)
  • v1.6.2(Aug 29, 2017)

    New features

    • Add ping demo for network

    Changes

    • Modify license to Apache License 2.0
    • Rename --smallest=y|n option to --small=y|n
    • Support stat64
    • Improve copy speed and fix permissions for tb_file_copy
    • Improve path operation for posix platform
    • Improve socket interfaces and support icmp
    • Improve xmake.lua and remove binary packages

    Bugs fixed

    • Fix create file mode to 0644
    • Fix file and directory path bug
    • Fix remove directory with dead symbol link failed
    • Fix remove readonly file failed
    • #34: Fix cache time and coroutine sleep bug
    • #35: Fix epoll bug with the edge trigger mode

    新特性

    • 增加ping测试程序

    改进

    • 修改license,使用更加宽松的Apache License 2.0
    • 重命名--smallest=y|n选项到--small=y|n
    • 使用stat64支持大文件信息获取
    • 改进tb_file_copy,更加快速的文件copy,并且修复copy后文件权限丢失问题
    • 改进posix平台下的路径操作
    • 改进socket初始化接口,支持icmp协议
    • 改进xmake.lua,移除内置二进制依赖包文件

    Bugs修复

    • 修复创建文件权限不对问题
    • 修复文件和目录路径问题
    • 修复无法移除带有无效软链的目录问题
    • 修复无法移除只读文件问题
    • #34: 修复缓存时间和协程sleep不准问题
    • #35: 修复epoll边缘触发模式下,centos上检测连接关闭失效问题
    Source code(tar.gz)
    Source code(zip)
  • v1.6.1(Dec 7, 2016)

    New features

    • Support coroutine context switch for mips
    • Add __tb_thread_local__ keyword macro
    • Add --micro=y|n option to compiling micro library (~64K) for the embed system
    • Add tb_addrinfo_addr and tb_addrinfo_name interfaces
    • Add stackless coroutine
    • Add semaphone and lock for the stackless coroutine

    Changes

    • Optimize io scheduler for coroutine, cache events for poller
    • Add c11 _Static_assert
    • Remove some deprecated interfaces for hash and platform

    新特性

    • 针对协程上下文切换,支持mips架构
    • 添加__tb_thread_local__关键字宏
    • 添加 --micro=y|n 选项,实现极小编译,针对嵌入式平台,编译tbox微内核(~64K)
    • 添加 tb_addrinfo_addr and tb_addrinfo_name 接口
    • 添加stackless协程,更加轻量的协程支持,每个协程只占用几十个bytes,同时支持io调度
    • 针对stackless协程,增加lock和semaphone支持

    改进

    • 为协程优化io调度器,缓存poller轮询等待,减少频繁重复调用epoll_ctl, kevent等系统接口
    • 添加对c11关键字_Static_assert的支持
    • 针对hash和platform模块,移除一些废弃的接口
    Source code(tar.gz)
    Source code(zip)
  • v1.6.0(Oct 30, 2016)

    New features

    • Support make command and compile directly without xmake
    • Add switch context interfaces into platform module
    • Add coroutine module (supports i386, x86_64, arm, arm64 ..)
    • Add simple http server demo using coroutine
    • Add simple spider using coroutine
    • Add io poller interfaces(with epoll, poll, kqueue, select)
    • Support mbedtls ssl library
    • All io modules(stream, socket, http, ..) support coroutine mode
    • Provide lock, semaphone and channel for coroutine

    Changes

    • Optimize and rewrite thread local store module
    • Modify thread interfaces
    • Mark the asio module as deprecated
    • Optimize exception interfaces

    Bugs fixed

    • Fix some warning and errors for compiler
    • Fix some thread bugs
    • Fix parse bplist uid type

    新特性

    • 支持make进行直接编译(会去自动下载xmake进行构建)
    • 在平台库中,添加切换context上下文接口(参考boost.context实现原理进行重写,并对部分架构进行优化)
    • 新增跨平台协程模块(支持i386, x86_64, arm, arm64),提供更加易用的高性能并发编程模式
    • 新增基于协程的各种服务器开发实例(包括:简单轻量的http服务器,爬虫。。)
    • 新增poller轮询器接口,实现对epoll, poll, kqueue, select的封装,逐步取代老的aiop接口
    • 新增mbedtls ssl库接口支持,目前已支持:openssl, polarssl, mbedtls
    • tbox所有stream, socket, http, dns, ssl 等io相关操作,原生支持协程模式,并且可以在线程和协程间随意切换
    • 为协程提供lock, semaphone, channel模块

    改进

    • 优化和重构线程局部存储TLS模块
    • 修改部分线程接口
    • asio模块被标记为废弃接口,下个版本将会被移除,逐步使用协程模式来实现异步io开发
    • 优化异常捕获接口

    Bugs修复

    • 修复一些编译警告和错误
    • 修复一些线相关bug
    • 修复bplist中解析uid类型失败问题
    Source code(tar.gz)
    Source code(zip)
  • v1.5.3(Aug 29, 2016)

    New features

    • Add wait multi-processes interface
    • Add uuid generator
    • Add hash library module
    • Add __tb_deprecated__ keyword and option

    Changes

    • Move some utils interfaces to the hash module
    • Rewrite random generator

    Bugs fixed

    • Fix stdout compatibility issue for vs2015
    • Fix process arguments length limit

    新特性

    • 增加同时等待多个进程接口
    • 增加uuid生成器
    • 增加hash库模块
    • 添加__tb_deprecated__关键字以及配置选项

    改进

    • 移动部分utils接口到hash模块
    • 重写random生成器

    Bugs修复

    • 修复stdout在vs2015以上版本的兼容性问题
    • 修复进程参数长度限制
    Source code(tar.gz)
    Source code(zip)
  • v1.5.2(Jun 25, 2016)

    New features

    • Add smallest configure option
    • Add process operation interfaces

    Changes

    • Improve envirnoment interfaces
    • Modify xmake.lua for supporting xmake v2.x

    Bugs fixed

    • Fix ltimer bug
    • Fix asio memory leaks bug
    • Fix asio httpd response bug on linux
    • Fix path bug for windows

    新特性

    • 增加smallest参数配置选项,实现一键配置最小化编译,禁用所有扩展模块和依赖库
    • 增加进程创建和控制接口

    改进

    • 增强环境变量设置接口
    • 修改xmake.lua支持最新版xmake v2.x, 简化编译配置

    Bugs修复

    • 修复ltimer定时器不准问题
    • 修复asio部分内存泄露问题
    • 修复asio/httpd在linux下keepalive模式,响应很慢问题
    • 修复windows下路径处理的一些bug
    Source code(tar.gz)
    Source code(zip)
  • v1.5.1(Jan 15, 2016)

    New features

    • Add automaticlly check libc interfaces
    • Support custom allocator
    • Add trace for allocator in the debug mode
    • Add static_pool module
    • Add stream interfaces for reading all data to string
    • Add adler32 hash algorithm
    • Add tb_memmem interface
    • Add regex module with pcre, pcre2 or posix regex

    Changes

    • Optimize stream and support read/write character device file
    • Modify tb_init api and support allocator arguments
    • Improve memory manager and use the allocator mode
    • Redefine assert and will abort for debug mode

    Bugs fixed

    • Fix some bugs for android
    • Fix seek bug for stream

    新特性

    • 自动检测所有系统libc接口,优先使用系统版本
    • 支持自定义内存分配器,并且能够在debug模式下,获取每次分配的代码位置信息,用于自定义追踪
    • 增加轻量级static_pool来维护整块buffer的内存分配,适合局部管理部分内存,pool虽然也能维护,但是底层基于large_pool,比较重量级,适合全局管理内存
    • 增加stream快速读取全部数据到string的接口
    • 增加adler32 hash算法
    • 增加tb_memmem接口
    • 采用pcre/pcre2/posix regex实现正则表达式库

    改进

    • 优化stream,支持对字符设备文件的读写
    • 修改tb_init接口,增加allocator自定义内存分配器参数,实现用户的侵入式内存管理
    • 重构内存管理,完全采用分配器allocator模式,可以灵活切换内存管理,支持原生系统内存、静态buffer内存、内存池等各种分配方式
    • 重定义assert,debug模式遇到assert直接abort执行

    Bugs修复

    • 修复android下的一些bug
    • 修复stream的seek问题
    Source code(tar.gz)
    Source code(zip)
Owner
TBOOX
?Focus on cross-platform development using c language
TBOOX
JUCE is an open-source cross-platform C++ application framework for desktop and mobile applications, including VST, VST3, AU, AUv3, RTAS and AAX audio plug-ins.

JUCE is an open-source cross-platform C++ application framework used for rapidly developing high quality desktop and mobile applications, including VS

JUCE 4.7k Jan 1, 2023
Kigs framework is a C++ modular multipurpose cross platform framework.

Kigs framework is a C++ modular multi-purpose cross-platform framework. It was used as a basis for many professionnal projects. The main goal was to b

null 74 Nov 28, 2022
openFrameworks is a community-developed cross platform toolkit for creative coding in C++.

openFrameworks openFrameworks is a C++ toolkit for creative coding. If you are new to OF, welcome! Build status The master branch contains the newest,

openFrameworks 9.2k Jan 3, 2023
EASTL stands for Electronic Arts Standard Template Library. It is an extensive and robust implementation that has an emphasis on high performance.

EA Standard Template Library EASTL stands for Electronic Arts Standard Template Library. It is a C++ template library of containers, algorithms, and i

Electronic Arts 6.9k Jan 3, 2023
Embedded Template Library

Embedded Template Library (ETL) Motivation C++ is a great language to use for embedded applications and templates are a powerful aspect. The standard

Embedded Template Library 1.5k Dec 28, 2022
An open-source C++ library developed and used at Facebook.

Folly: Facebook Open-source Library What is folly? Folly (acronymed loosely after Facebook Open Source Library) is a library of C++14 components desig

Facebook 24k Jan 1, 2023
Functional Programming Library for C++. Write concise and readable C++ code.

FunctionalPlus helps you write concise and readable C++ code. Table of contents Introduction Usage examples Type deduction and useful error messages T

Tobias Hermann 1.7k Dec 29, 2022
KoanLogic 400 Dec 25, 2022
NIH Utility Library

libnih is a light-weight "standard library" of C functions to ease the development of other libraries and applications. Its goals are: * despite it

Scott James Remnant 81 Dec 10, 2022
An open source library for C

Homo Deus - C Library Introduction The Homo Deus C Library (hdelibc) is an open source collection of tools for the C programming language. The project

Homo Deus 115 Dec 11, 2022
A convenience C++ wrapper library for JSON-Glib providing friendly syntactic sugar for parsing JSON

This library is a wrapper for the json-glib library that aims to provide the user with a trivial alternative API to the API provided by the base json-

Rob J Meijer 17 Oct 19, 2022
A repository I'm using to learn hashing with GLib.

GLib Tests Description A repository I'm using to store my progress while learning GNOME's GLib library. Specifically hashing via ghash. Test Files GLi

Christian Deacon 9 Oct 24, 2022
Distributed (Deep) Machine Learning Community 682 Dec 28, 2022
Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator framework, based on QEMU.

Unicorn Engine Unicorn is a lightweight, multi-platform, multi-architecture CPU emulator framework, based on QEMU. Unicorn offers some unparalleled fe

lazymio 1 Nov 7, 2021
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

aria2 28.7k Jan 7, 2023
multi-sdr-gps-sim generates a IQ data stream on-the-fly to simulate a GPS L1 baseband signal using a SDR platform like HackRF or ADLAM-Pluto.

multi-sdr-gps-sim generates a GPS L1 baseband signal IQ data stream, which is then transmitted by a software-defined radio (SDR) platform. Supported at the moment are HackRF, ADLAM-Pluto and binary IQ file output. The software interacts with the user through a curses based text user interface (TUI) in terminal.

null 70 Dec 27, 2022
A cross platform shader language with multi-threaded offline compilation or platform shader source code generation

A cross platform shader language with multi-threaded offline compilation or platform shader source code generation. Output json reflection info and c++ header with your shaders structs, fx-like techniques and compile time branch evaluation via (uber-shader) "permutations".

Alex Dixon 286 Dec 14, 2022
A fast multi-producer, multi-consumer lock-free concurrent queue for C++11

moodycamel::ConcurrentQueue An industrial-strength lock-free queue for C++. Note: If all you need is a single-producer, single-consumer queue, I have

Cameron 7.4k Jan 3, 2023
A bounded multi-producer multi-consumer concurrent queue written in C++11

MPMCQueue.h A bounded multi-producer multi-consumer concurrent queue written in C++11. It's battle hardened and used daily in production: In the Frost

Erik Rigtorp 836 Dec 25, 2022
Multi-dimensional dynamically distorted staggered multi-bandpass LV2 plugin

B.Angr A multi-dimensional dynamicly distorted staggered multi-bandpass LV2 plugin, for extreme soundmangling. Based on Airwindows XRegion. Key featur

null 21 Nov 7, 2022