[M3devel] some code from boost?

Jay K jay.krell at cornell.edu
Tue Jul 5 09:54:14 CEST 2016


I'd like to bring in some code from boost.

To m3core -- Thread.HardwareConcurrency, i.e. the number of processors

It is licensed like so:

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

http://www.boost.org/LICENSE_1_0.txt)

I find the license a little long and would rather not have more, but it is a good body of work overall.

I would put the code in circa m3core/thread/boost/win32, m3core/thread/boost/posix
or maybe m3core/thread/Common/ThreadBoostWin32.c ThreadBoostPosix.c


ok? esp. on the licensing?

It is just a few lines of code.

They call this thread::hardware_concurrency and it is the number of CPUs or cores (this number
is actually ambiguous these days, with packages, cores, and hyper-threading).

They have another number called physical_concurrency we might want to also provide.

They have implementations for at least the following the systems:
 Win32 GetSystemInfo
 glibc get_nprocs
 sysconf(_SC_NPROCESSORS_ONLN)
 Apple and FreeBSD sysctlbyname("hw.ncpu")
 HP-UX pthread_num_processors_np

For licensing or at least credit purposs, it should be two files -- Win32 and Posix.

The code is C++ but can be changed to C, and for should should be.

I suppose, if the license is too restrictive, I can keep it out of m3core and put it only in cm3?

 - Jay 		 	   		  


More information about the M3devel mailing list