Free resources when 'nget.noatomic' thread terminates 94/3294/2
authorHeinonen Arvo <arvo.heinonen@nokia.com>
Thu, 16 Apr 2020 07:22:31 +0000 (10:22 +0300)
committerHeinonen Arvo <arvo.heinonen@nokia.com>
Thu, 16 Apr 2020 09:47:16 +0000 (12:47 +0300)
commitf1d51777ca5f82b3a50c4fcf33d580abf2c43f25
tree30858502462eec659e1b833950e595a806219f70
parent5ad6f527365cf159f5466bfc47bd3bc54cb3d385
Free resources when 'nget.noatomic' thread terminates

Call 'pthread_detach' from newly created thread.

Update unit tests to check that 'pthread_detach'
is called.

Update redismodule test container base image to '2-rmr1.13.1'
because '1-rmr1.13.1' no longer exists.

Previously the redismodule command 'nget.noatomic'
started a thread but the started thread was never
cleaned up because by default pthread cleans up
threads only when 'pthread_join' is called.
In case of 'nget.noatomic' the thread from which
'pthread_create' is called terminates immediately
and 'pthread_join' is never called resulting in
a resource leak.
We expect the created thread to be joined.
Therefore we need to call 'pthread_detach' from the
newly created thread which signals to pthread that
the resources allocated by the newly created thread
can be deallocated when the thread terminates.

Signed-off-by: Heinonen Arvo <arvo.heinonen@nokia.com>
Change-Id: If4d076fc4d58f65896638e99948c2d91a0000a9b
docker/Dockerfile.redis
redismodule/src/exstrings.c
redismodule/tst/mock/include/commonStub.h
redismodule/tst/mock/src/commonStub.cpp
redismodule/tst/src/exstrings_nget_test.cpp