-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit with implementations of:
- `async_signal_safe_tls` - `current_thread_id`
- Loading branch information
Showing
19 changed files
with
3,027 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
Language: Cpp | ||
AccessModifierOffset: -2 | ||
ConstructorInitializerIndentWidth: 4 | ||
AlignEscapedNewlinesLeft: false | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortBlocksOnASingleLine: false | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AllowShortFunctionsOnASingleLine: Inline | ||
AlwaysBreakTemplateDeclarations: false | ||
AlwaysBreakBeforeMultilineStrings: false | ||
BreakBeforeBinaryOperators: None | ||
BreakBeforeBraces: Allman | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializersBeforeComma: true | ||
BinPackParameters: true | ||
ColumnLimit: 120 | ||
CommentPragmas: '^!<' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ContinuationIndentWidth: 0 | ||
Cpp11BracedListStyle: true | ||
DerivePointerAlignment: false | ||
DisableFormat: false | ||
ExperimentalAutoDetectBinPacking: false | ||
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] | ||
IndentCaseLabels: false | ||
IndentFunctionDeclarationAfterType: false | ||
IndentWidth: 2 | ||
IndentWrappedFunctionNames: false | ||
MaxEmptyLinesToKeep: 2 | ||
KeepEmptyLinesAtTheStartOfBlocks: true | ||
NamespaceIndentation: All | ||
ObjCSpaceAfterProperty: false | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 19 | ||
PenaltyBreakComment: 300 | ||
PenaltyBreakString: 1000 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 60 | ||
PointerAlignment: Right | ||
Standard: Cpp11 | ||
SpaceAfterCStyleCast: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: Never | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInParentheses: false | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInContainerLiterals: true | ||
TabWidth: 8 | ||
UseTab: Never | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
* text=auto !eol svneol=native#text/plain | ||
*.gitattributes text svneol=native#text/plain | ||
|
||
cmake/headers.cmake eol=lf | ||
cmake/interface.cmake eol=lf | ||
cmake/sources.cmake eol=lf | ||
cmake/tests.cmake eol=lf | ||
|
||
# Scriptish formats | ||
*.bat text svneol=native#text/plain | ||
*.bsh text svneol=native#text/x-beanshell | ||
*.cgi text svneol=native#text/plain | ||
*.cmd text svneol=native#text/plain | ||
*.js text svneol=native#text/javascript | ||
*.php text svneol=native#text/x-php | ||
*.pl text svneol=native#text/x-perl | ||
*.pm text svneol=native#text/x-perl | ||
*.py text svneol=native#text/x-python | ||
*.sh eol=lf svneol=LF#text/x-sh | ||
configure eol=lf svneol=LF#text/x-sh | ||
|
||
# Image formats | ||
*.bmp binary svneol=unset#image/bmp | ||
*.gif binary svneol=unset#image/gif | ||
*.ico binary svneol=unset#image/ico | ||
*.jpeg binary svneol=unset#image/jpeg | ||
*.jpg binary svneol=unset#image/jpeg | ||
*.png binary svneol=unset#image/png | ||
*.tif binary svneol=unset#image/tiff | ||
*.tiff binary svneol=unset#image/tiff | ||
*.svg text svneol=native#image/svg%2Bxml | ||
|
||
# Data formats | ||
*.pdf binary svneol=unset#application/pdf | ||
*.avi binary svneol=unset#video/avi | ||
*.doc binary svneol=unset#application/msword | ||
*.dsp text svneol=crlf#text/plain | ||
*.dsw text svneol=crlf#text/plain | ||
*.eps binary svneol=unset#application/postscript | ||
*.json text svneol=native#application/json | ||
*.gz binary svneol=unset#application/gzip | ||
*.mov binary svneol=unset#video/quicktime | ||
*.mp3 binary svneol=unset#audio/mpeg | ||
*.ppt binary svneol=unset#application/vnd.ms-powerpoint | ||
*.ps binary svneol=unset#application/postscript | ||
*.psd binary svneol=unset#application/photoshop | ||
*.rdf binary svneol=unset#text/rdf | ||
*.rss text svneol=unset#text/xml | ||
*.rtf binary svneol=unset#text/rtf | ||
*.sln text svneol=native#text/plain | ||
*.swf binary svneol=unset#application/x-shockwave-flash | ||
*.tgz binary svneol=unset#application/gzip | ||
*.vcproj text svneol=native#text/xml | ||
*.vcxproj text svneol=native#text/xml | ||
*.vsprops text svneol=native#text/xml | ||
*.wav binary svneol=unset#audio/wav | ||
*.xls binary svneol=unset#application/vnd.ms-excel | ||
*.zip binary svneol=unset#application/zip | ||
|
||
# Text formats | ||
.htaccess text svneol=native#text/plain | ||
*.bbk text svneol=native#text/xml | ||
*.cmake text svneol=native#text/plain | ||
*.css text svneol=native#text/css | ||
*.dtd text svneol=native#text/xml | ||
*.htm text svneol=native#text/html | ||
*.html text svneol=native#text/html | ||
*.ini text svneol=native#text/plain | ||
*.log text svneol=native#text/plain | ||
*.mak text svneol=native#text/plain | ||
*.qbk text svneol=native#text/plain | ||
*.rst text svneol=native#text/plain | ||
*.sql text svneol=native#text/x-sql | ||
*.txt text svneol=native#text/plain | ||
*.xhtml text svneol=native#text/xhtml%2Bxml | ||
*.xml text svneol=native#text/xml | ||
*.xsd text svneol=native#text/xml | ||
*.xsl text svneol=native#text/xml | ||
*.xslt text svneol=native#text/xml | ||
*.xul text svneol=native#text/xul | ||
*.yml text svneol=native#text/plain | ||
boost-no-inspect text svneol=native#text/plain | ||
CHANGES text svneol=native#text/plain | ||
COPYING text svneol=native#text/plain | ||
INSTALL text svneol=native#text/plain | ||
Jamfile text svneol=native#text/plain | ||
Jamroot text svneol=native#text/plain | ||
Jamfile.v2 text svneol=native#text/plain | ||
Jamrules text svneol=native#text/plain | ||
Makefile* text svneol=native#text/plain | ||
README text svneol=native#text/plain | ||
TODO text svneol=native#text/plain | ||
|
||
# Code formats | ||
*.c text svneol=native#text/plain | ||
*.cpp text svneol=native#text/plain | ||
*.h text svneol=native#text/plain | ||
*.hpp text svneol=native#text/plain | ||
*.ipp text svneol=native#text/plain | ||
*.tpp text svneol=native#text/plain | ||
*.jam text svneol=native#text/plain | ||
*.java text svneol=native#text/plain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: ned14 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 1 * *' | ||
|
||
jobs: | ||
Linux: | ||
name: Linux | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
compiler: [clang++, g++] | ||
debug: [Debug, Release] | ||
standard: [11, 23] | ||
shared: [OFF, ON] | ||
env: | ||
NAME: Linux-${{ matrix.compiler }}-${{ matrix.debug }}-${{ matrix.standard }}-${{ matrix.shared }} | ||
CXX: ${{ matrix.compiler }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure Linux | ||
shell: bash | ||
run: | | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.debug }} -DCMAKE_C_STANDARD=${{ matrix.standard }} -DBUILD_SHARED_LIBS=${{ matrix.shared }} | ||
- name: Build Linux | ||
shell: bash | ||
run: cd build && cmake --build . --parallel | ||
|
||
- name: CMake tests Linux | ||
shell: bash | ||
run: cd build && ctest --output-on-failure --timeout 300 | ||
|
||
MacOS: | ||
name: Mac OS | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
debug: [Debug, Release] | ||
standard: [11, 23] | ||
shared: [OFF, ON] | ||
env: | ||
NAME: MacOS-${{ matrix.debug }}-${{ matrix.standard }}-${{ matrix.shared }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure Mac OS | ||
shell: bash | ||
run: | | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_BUILD_TYPE=${{ matrix.debug }} -DCMAKE_C_STANDARD=${{ matrix.standard }} -DBUILD_SHARED_LIBS=${{ matrix.shared }} | ||
- name: Build Mac OS | ||
shell: bash | ||
run: cd build && cmake --build . --parallel | ||
|
||
- name: CMake tests Mac OS | ||
shell: bash | ||
run: cd build && ctest --output-on-failure --timeout 300 | ||
|
||
Windows: | ||
name: Windows VS2022 | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
debug: [Debug, Release] | ||
standard: [11, 17] | ||
shared: [OFF, ON] | ||
env: | ||
NAME: Windows-${{ matrix.debug }}-${{ matrix.standard }}-${{ matrix.shared }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Configure WinVS2022 | ||
shell: bash | ||
run: | | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_C_STANDARD=${{ matrix.standard }} -DBUILD_SHARED_LIBS=${{ matrix.shared }} | ||
- name: Build WinVS2022 | ||
shell: bash | ||
run: cd build && cmake --build . --config ${{ matrix.debug }} --parallel | ||
|
||
- name: CMake tests WinVS2022 | ||
shell: bash | ||
run: cd build && ctest -C ${{ matrix.debug }} --output-on-failure --timeout 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
cmake_minimum_required(VERSION 3.15 FATAL_ERROR) | ||
|
||
option(BUILD_SHARED_LIBS "Build using shared libraries" OFF) | ||
set(CMAKE_C_VISIBILITY_PRESET "hidden" CACHE STRING "Only make explicitly exported symbols visible") | ||
set(CMAKE_CXX_VISIBILITY_PRESET "hidden" CACHE STRING "Only make explicitly exported symbols visible") | ||
set(CMAKE_C_STANDARD "11" CACHE STRING "C standard to use") | ||
|
||
project(wg14_signals LANGUAGES C CXX) | ||
include(GNUInstallDirs) | ||
enable_testing() | ||
|
||
set(LIBRARY_SOURCES | ||
"src/wg14_signals/async_signal_safe_tls.c" | ||
"src/wg14_signals/current_thread_id.c" | ||
|
||
# Not mandatory and can be substituted | ||
"src/wg14_signals/thread_atexit.cpp" | ||
) | ||
|
||
add_library(${PROJECT_NAME} ${LIBRARY_SOURCES}) | ||
target_compile_features(${PROJECT_NAME} PRIVATE c_std_11 cxx_std_11) | ||
target_compile_definitions(${PROJECT_NAME} PRIVATE WG14_SIGNALS_SOURCE) | ||
target_include_directories(${PROJECT_NAME} PUBLIC | ||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>" | ||
"$<INSTALL_INTERFACE:include>" | ||
) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES | ||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" | ||
) | ||
if(WIN32) | ||
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /experimental:c11atomics) | ||
else() | ||
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) | ||
endif() | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
EXPORT ${PROJECT_NAME}Exports | ||
INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" | ||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" | ||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" | ||
) | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_LIST_DIR}/cmake/ProjectConfig.cmake.in" | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
@ONLY | ||
) | ||
install(FILES | ||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" | ||
) | ||
install(EXPORT ${PROJECT_NAME}Exports | ||
NAMESPACE ${PROJECT_NAME}:: | ||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" | ||
) | ||
|
||
if(PROJECT_IS_TOP_LEVEL AND (NOT DEFINED BUILD_TESTING OR BUILD_TESTING)) | ||
function(add_code_example target) | ||
cmake_parse_arguments(ADD_EXAMPLE "" "" "SOURCES;FEATURES;PROPERTIES" ${ARGN}) | ||
add_executable(${target} ${ADD_EXAMPLE_SOURCES}) | ||
target_compile_features(${target} PRIVATE ${ADD_EXAMPLE_FEATURES}) | ||
target_link_libraries(${target} PRIVATE ${PROJECT_NAME}) | ||
set_target_properties(${target} PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" | ||
${ADD_EXAMPLE_PROPERTIES} | ||
) | ||
endfunction() | ||
function(add_code_test target) | ||
add_code_example(${target} ${ARGN}) | ||
add_test(NAME ${target} COMMAND $<TARGET_FILE:${target}>) | ||
endfunction() | ||
|
||
add_subdirectory("test") | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Reference implementation for proposed extensions to standard C signals handling | ||
|
||
(C) 2024 Niall Douglas [http://www.nedproductions.biz/](http://www.nedproductions.biz/) | ||
|
||
CI: [![CI](https://github.com/ned14/wg14_signals/actions/workflows/ci.yml/badge.svg)](https://github.com/ned14/wg14_signals/actions/workflows/ci.yml) | ||
|
||
Can be configured to be a standard library implementation for your | ||
standard C library runtime. Licensed permissively. | ||
|
||
## Example of use | ||
|
||
```c | ||
todo | ||
``` | ||
|
||
## Supported targets | ||
|
||
This library should work well on any POSIX implementation, as well as | ||
Microsoft Windows. You will need a minimum of C 11 in your toolchain. | ||
Every architecture supporting C 11 atomics should work. | ||
|
||
Current CI test targets: | ||
|
||
- Ubuntu Linux, x64. | ||
- Mac OS, AArch64. | ||
- Microsoft Windows, x64. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@PACKAGE_INIT@ | ||
|
||
@PROJECT_PACKAGE_DEPENDENCIES@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Exports.cmake") | ||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@SlExports.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@SlExports.cmake") | ||
endif() | ||
if (EXISTS "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@DlExports.cmake") | ||
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@DlExports.cmake") | ||
endif() | ||
|
||
check_required_components(@PROJECT_NAME@) |
Oops, something went wrong.