View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0038090||FPC||Documentation||public||2020-11-17 08:04||2020-11-17 09:25|
|Reporter||tiberius||Assigned To||Michael Van Canneyt|
|Summary||0038090: [Unix] Critical Sections do not raise exceptions if not used with cthreads|
I had problems troubleshooting down the following problem: If I add a critical section within a project on linux which does NOT use cthreads (because in this project (shared library) no extra threads are present) the code for Initialization, Entering, Leaving and Finalization (Done) of a Critical Secion is executed without an error.
But it turns out, that there is no critical section created or entered (the TCriticalSection record stays in its original state). The API documentation does not mention this behavior (https://www.freepascal.org/docs-html/rtl/system/initcriticalsection.html, https://www.freepascal.org/docs-html/rtl/system/entercriticalsection.html). The only hint I could find is the one here: https://www.freepascal.org/docs-html/current/prog/progse45.html "[...] The FPC heap manager uses critical sections when multithreading is enabled. [...]"
There should be an exception on InitCiriticalSecion on Linux if cthreads is not present (like if trying to create and run a TThread without this unit).
|Steps To Reproduce||1. Create a library (shared object/dll) which makes use of the same Critical Section in two methods|
1. (a) Do NOT make use of the cthreads unit in this library
2. Call the library's methods from several threads of another application, which binds this library and try to create a clash
|Tags||No tags attached.|
|Fixed in Revision|
|2020-11-17 08:04||tiberius||New Issue|
|2020-11-17 09:24||Michael Van Canneyt||Assigned To||=> Michael Van Canneyt|
|2020-11-17 09:24||Michael Van Canneyt||Status||new => assigned|
|2020-11-17 09:24||Michael Van Canneyt||Category||RTL => Documentation|
|2020-11-17 09:24||Michael Van Canneyt||FPCTarget||=> -|
|2020-11-17 09:25||Michael Van Canneyt||Note Added: 0126995|