2021-06-18 14:41 (UTC-0700), Narcisa Ana Maria Vasile:
On Wed, Jun 09, 2021 at 02:04:09AM +0300, Dmitry Kozlyuk wrote:
quoted
2021-06-04 16:44 (UTC-0700), Narcisa Ana Maria Vasile:
[...]
quoted
quoted
+
+ HANDLE thread_handle = NULL;
+ GROUP_AFFINITY thread_affinity;
+ struct thread_routine_ctx *ctx = NULL;
+
+ ctx = calloc(1, sizeof(*ctx));
Why use `calloc()` for a scalar?
ctx is pointer to struct that holds the thread function pointer and its arguments.
Did I misunderstand what you meant?
`calloc(size_t n, size_t size)` mainly exists for safe array allocations,
because multiplication in `malloc(n * size)` may overflow. You are allocating
a singular value, i. e. a scalar, so the choice of `calloc()` over `malloc()`
raises questions. Nevertheless, it is harmless and works correctly. Consider
it a nit.