Skip to content
Snippets Groups Projects
Commit 3f9d203b authored by Glauber Costa's avatar Glauber Costa Committed by Avi Kivity
Browse files

pthread: implement sem_destroy


Note that we don't allocate memory in sem_init: we are using placement new to
just construct the object over an already existing memory location. Therefore,
all we need to do is release our unique_ptr

Thanks Pawel for noticing we need to release memory of the internal semaphore

Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
Signed-off-by: default avatarAvi Kivity <avi@cloudius-systems.com>
parent 2da050a4
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,12 @@ int sem_init(sem_t* s, int pshared, unsigned val)
return 0;
}
int sem_destroy(sem_t *s)
{
from_libc(s).~indirect_semaphore();
return 0;
}
int sem_post(sem_t* s)
{
from_libc(s)->post();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment