Skip to content

Confirm whether SetMaxThreads() call is necessary #168

@tameware

Description

@tameware

Per tzimnoch
examples/calc_dd_table_pbn.cpp
Comment on lines +30 to 32
#if defined(__linux) || defined(APPLE) || defined(WASM)
SetMaxThreads(0);
#endif

(#163 (comment))
Out of scope for this PR, but I noticed this in the 2.9.0 version of DDS as well and compensated by calling SetMaxThreads(1) from javascript on the wasm instance after loading it. I can verify whether SetMaxThreads(0) has the same effect.

I feel this is something the library should handle during its initialization. As it stands, failing to call this function before any solve function causes the dds library to crash.

doc/DLL-dds_x.htm has this to say about it currently:

The number of threads can be influenced by calling SetMaxThreads.
This function should probably always be called on Linux/Mac, with a zero argument for auto-configuration.
and

Calling SetMaxThreads is optional, not mandatory.
DDS will always select a suitable number of threads on its own.
I have not found this to be true, at least not for wasm binary. It appears to be required to prevent wasm binary from crashing.

(#163 (comment))

It is possible this was fixed between 2.9.0 and 3.0.0. I have not re-verified, but the inclusion of the call here leads me to believe it's still an issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions