Skip to content

Commit

Permalink
Merge pull request #2256 from sphaero/zactor_threadname
Browse files Browse the repository at this point in the history
set zactor threadname for convenience
  • Loading branch information
bluca authored Jan 26, 2023
2 parents 95e24a0 + 2da939b commit 4390cc8
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 32 deletions.
35 changes: 10 additions & 25 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,37 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: default
DRAFT: enabled
CLANG_FORMAT: clang-format-11
PACKAGES: automake autoconf clang-format-11 git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev asciidoc xmlto
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: default
DRAFT: disabled
CLANG_FORMAT: clang-format-11
PACKAGES: automake autoconf clang-format-11 git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: valgrind
DRAFT: enabled
PACKAGES: automake autoconf valgrind git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev ubuntu-dbgsym-keyring
- os: ubuntu-latest
PACKAGES: automake autoconf valgrind git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev
- os: ubuntu-20.04
BUILD_TYPE: cmake
DRAFT: enabled
PACKAGES: cmake git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev
- os: macos-latest
BUILD_TYPE: default
PACKAGES: automake autoconf ossp-uuid zeromq curl libmicrohttpd
DRAFT: enabled
CI_SELFTEST: no
- os: macos-latest
BUILD_TYPE: default
DRAFT: disabled
CI_SELFTEST: no
PACKAGES: automake autoconf ossp-uuid zeromq curl libmicrohttpd
# For non-cmake users, there is an autotools solution with a bit more overhead
# to have dependencies ready and pass configure script before making this check).
# Note that the autotools variant will also require dependencies preinstalled to
# pass its configure script:
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: cmake
DO_CLANG_FORMAT_CHECK: 1
CLANG_FORMAT: clang-format-11
Expand All @@ -56,10 +54,10 @@ jobs:
# 1) Your project sources have a "latest_release" branch or tag
# to check out and compare the current commit's ABI to;
# 2) Prerequisites are available as packages - no custom rebuilds.
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: abi-compliance-checker
PACKAGES: universal-ctags abi-dumper abi-compliance-checker git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev
- os: ubuntu-latest
- os: ubuntu-20.04
BUILD_TYPE: check_zproject
PACKAGES: git uuid-dev libsystemd-dev liblz4-dev libnss3-dev libzmq3-dev libcurl4-nss-dev libmicrohttpd-dev generator-scripting-language zproject
env:
Expand All @@ -84,26 +82,13 @@ jobs:
CI_SELFTEST: ${{ matrix.CI_SELFTEST }}
steps:
- name: Add debian packages
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-20.04'
uses: myci-actions/add-deb-repo@10
with:
repo-name: obs
repo: deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/ ./
keys-asc: https://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/Release.key
install: ${{ matrix.PACKAGES }}
- name: Add dbgsym packages (main)
if: matrix.os == 'ubuntu-latest' && matrix.BUILD_TYPE == 'valgrind'
uses: myci-actions/add-deb-repo@10
with:
repo-name: dbgsym-main
repo: deb http://ddebs.ubuntu.com focal main
- name: Add dbgsym packages (updates)
if: matrix.os == 'ubuntu-latest' && matrix.BUILD_TYPE == 'valgrind'
uses: myci-actions/add-deb-repo@10
with:
repo-name: dbgsym-updates
repo: deb http://ddebs.ubuntu.com focal-updates main
install: libcurl3-nss-dbgsym
- name: Add brew packages
if: matrix.os == 'macos-latest'
shell: bash
Expand All @@ -112,7 +97,7 @@ jobs:
with:
path: czmq
- name: build
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-latest'
shell: bash
working-directory: czmq
run: ./ci_build.sh
28 changes: 21 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ set(OPTIONAL_LIBRARIES_STATIC)
########################################################################
# LIBZMQ dependency
########################################################################
find_package(libzmq REQUIRED)
IF (NOT libzmq_FOUND)
find_package(libzmq REQUIRED)
ENDIF(NOT libzmq_FOUND)
IF (libzmq_FOUND)
include_directories(${libzmq_INCLUDE_DIRS})
list(APPEND MORE_LIBRARIES ${libzmq_LIBRARIES})
Expand All @@ -147,7 +149,9 @@ ENDIF (libzmq_FOUND)
########################################################################
# UUID dependency
########################################################################
find_package(uuid)
IF (NOT uuid_FOUND)
find_package(uuid)
ENDIF(NOT uuid_FOUND)
option(CZMQ_WITH_UUID "Build czmq with uuid" ${UUID_FOUND})
IF (CZMQ_WITH_UUID AND uuid_FOUND)
include_directories(${uuid_INCLUDE_DIRS})
Expand All @@ -165,7 +169,9 @@ ENDIF (CZMQ_WITH_UUID AND uuid_FOUND)
########################################################################
# SYSTEMD dependency
########################################################################
find_package(systemd)
IF (NOT systemd_FOUND)
find_package(systemd)
ENDIF(NOT systemd_FOUND)
option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" ${SYSTEMD_FOUND})
IF (CZMQ_WITH_SYSTEMD AND systemd_FOUND)
include_directories(${systemd_INCLUDE_DIRS})
Expand All @@ -183,7 +189,9 @@ ENDIF (CZMQ_WITH_SYSTEMD AND systemd_FOUND)
########################################################################
# LZ4 dependency
########################################################################
find_package(lz4)
IF (NOT lz4_FOUND)
find_package(lz4)
ENDIF(NOT lz4_FOUND)
option(CZMQ_WITH_LZ4 "Build czmq with lz4" ${LZ4_FOUND})
IF (CZMQ_WITH_LZ4 AND lz4_FOUND)
include_directories(${lz4_INCLUDE_DIRS})
Expand All @@ -201,7 +209,9 @@ ENDIF (CZMQ_WITH_LZ4 AND lz4_FOUND)
########################################################################
# LIBCURL dependency
########################################################################
find_package(libcurl)
IF (NOT libcurl_FOUND)
find_package(libcurl)
ENDIF(NOT libcurl_FOUND)
option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ${LIBCURL_FOUND})
IF (CZMQ_WITH_LIBCURL AND libcurl_FOUND)
include_directories(${libcurl_INCLUDE_DIRS})
Expand All @@ -219,7 +229,9 @@ ENDIF (CZMQ_WITH_LIBCURL AND libcurl_FOUND)
########################################################################
# NSS dependency
########################################################################
find_package(nss)
IF (NOT nss_FOUND)
find_package(nss)
ENDIF(NOT nss_FOUND)
option(CZMQ_WITH_NSS "Build czmq with nss" ${NSS_FOUND})
IF (CZMQ_WITH_NSS AND nss_FOUND)
include_directories(${nss_INCLUDE_DIRS})
Expand All @@ -237,7 +249,9 @@ ENDIF (CZMQ_WITH_NSS AND nss_FOUND)
########################################################################
# LIBMICROHTTPD dependency
########################################################################
find_package(libmicrohttpd)
IF (NOT libmicrohttpd_FOUND)
find_package(libmicrohttpd)
ENDIF(NOT libmicrohttpd_FOUND)
option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" ${LIBMICROHTTPD_FOUND})
IF (CZMQ_WITH_LIBMICROHTTPD AND libmicrohttpd_FOUND)
include_directories(${libmicrohttpd_INCLUDE_DIRS})
Expand Down
24 changes: 24 additions & 0 deletions builds/ios/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# iOS Build

## Prerequisites

The build script require to be run on MacOs with XCode and the developer SDK installed.

This project is tested against SDK 15.5.

If you want to specify another version you need to set the environment variable below:

export SDK_VERSION=15.5

You can list all the versions of the SDK installed on your Mac using the command below:

xcodebuild -showsdks

## Build

In the ios directory, run:
./build.sh [ iPhoneOS armv7 | iPhoneOS armv7s | iPhoneOS arm64 | iPhoneSimulator i386 | iPhoneSimulator x86_64 ]

Note that certain target architectures may or may not be available depending on your target SDK Version. For example, iOS 10 is the maximum deployment target for 32-bit targets.

[This website](https://docs.elementscompiler.com/Platforms/Cocoa/CpuArchitectures/) can help you choose which architecture you need to target depending on your SDK version.
70 changes: 70 additions & 0 deletions builds/ios/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################

set -e

function usage {
echo "Usage ./build.sh [ iPhoneOS armv7 | iPhoneOS armv7s | iPhoneOS arm64 | iPhoneSimulator i386 | iPhoneSimulator x86_64 ]"
}

PLATFORM=$1
if [ -z PLATFORM ]; then
usage
exit 1
fi

if [[ $PLATFORM == "iPhoneOS" ]]; then
SDK="iphoneos"
elif [[ $PLATFORM == "iPhoneSimulator" ]]; then
SDK="iphonesimulator"
else
echo "Unknown platform '$PLATFORM'"
usage
exit 1
fi

TARGET=$2
if [ -z $TARGET ]; then
usage
exit 1
fi

if [[ $TARGET == "x86_64" ]]; then
HOST="i386"
elif [[ $TARGET == "arm64" ]]; then
HOST="arm"
else
HOST=$TARGET
fi

export SDK_VERSION=${SDK_VERSION:-"15.5"}

PLATFORM_PATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLCHAIN_PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
SYSROOT=$PLATFORM_PATH/$PLATFORM.platform/Developer/SDKs/$PLATFORM$SDK_VERSION.sdk
OUTPUT_DIR=output/$PLATFORM/$TARGET
PWD="$(pwd)"

export CC="$(xcrun -sdk $SDK -find clang)"
export CPP="$CC -E"
export AR="$(xcrun -sdk $SDK -find ar)"
export RANLIB="$(xcrun -sdk $SDK -find ranlib)"
export CFLAGS="-arch $TARGET -isysroot $SYSROOT -miphoneos-version-min=$SDK_VERSION -fembed-bitcode"
export CPPFLAGS="-arch $TARGET -isysroot $SYSROOT -miphoneos-version-min=$SDK_VERSION -fembed-bitcode"
export LDFLAGS="-arch $TARGET -isysroot $SYSROOT"

cd ../../
mkdir -p $OUTPUT_DIR
./autogen.sh
./configure --prefix="$PWD/$OUTPUT_DIR" --host=$HOST-apple-darwin
make
make install

echo "$PLATFORM $TARGET build successful"
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################
16 changes: 16 additions & 0 deletions builds/ios/ci_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################

#./build.sh "iPhoneOS" "armv7" # Only available with SDK_VERSION <= 10
#./build.sh "iPhoneOS" "armv7s" # Only available with SDK_VERSION <= 10
./build.sh "iPhoneOS" "arm64"
#./build.sh "iPhoneSimulator" "i386" # Only available with SDK_VERSION <= 10
./build.sh "iPhoneSimulator" "x86_64"

################################################################################
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
# Read the zproject/README.md for information about making permanent changes. #
################################################################################
5 changes: 5 additions & 0 deletions src/zactor.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ zactor_new (zactor_fn actor, void *args)
#if defined (__UNIX__)
pthread_t thread;
pthread_create (&thread, NULL, s_thread_shim, shim);
#if defined (__UTYPE_OSX)
pthread_setname_np("ZACTOR");
#else
pthread_setname_np(thread, "ZACTOR");
#endif
pthread_detach (thread);

#elif defined (__WINDOWS__)
Expand Down

0 comments on commit 4390cc8

Please sign in to comment.