HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Library/share/b2/tools/features/threadapi-feature.jam
# Copyright 2017 Alexander Karzhenkov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)

import property-set ;
import feature : feature ;
import toolset ;
import features/os-feature ;

#| tag::doc[]

[[bbv2.builtin.features.threadapi]]`threadapi`::
*Allowed values:* `pthread`, `win32`.
+
Selects threading implementation. The default is `win32` if `<target-os>` is
`windows` and `pthread` otherwise.

|# # end::doc[]

feature threadapi : pthread win32 : symmetric propagated ;
toolset.add-defaults <target-os>windows:<threadapi>win32 ;

rule get-default ( property-set )
{
    local api = pthread ;
    if [ $(property-set).get <target-os> ] = windows { api = win32 ; }
    return $(api) ;
}

# Obsolete rule that didn't quite work.  Remove this
# after all references to it have been cleaned up.
rule detect ( properties * )
{
    # local ps = [ property-set.create $(properties) ] ;
    # local api = [ $(ps).get <threadapi> ] ;
    # if ! $(api) { api = [ get-default $(ps) ] ; }
    # return <threadapi>$(api) <relevant>threadapi:<relevant>target-os ;
}