@msteed
Thanks! Will test both ways!
Regarding semaphores in general: i talked with Andrea (who workign now on clib2) , and some time ago he had some problem with Semaphores too, when InitSemaphores on semaphore is not created with AllocVecTags. I.e. now in our sem_init() from libpsem is:
int sem_init(sem_t *sem, int pshared, unsigned int value)
{
isem_t *isem;
isem = malloc(sizeof(isem_t));
if (isem == NULL)
{
errno = ENOMEM;
return -1;
}
IExec->InitSemaphore(&isem->accesslock);
IExec->NewList(&isem->waitlist);
isem->value = value;
*sem = isem;
return 0;
}
But what Andrea mean it should be something like :
isem->accesslock = AllocVecTags(sizeof(isem->accesslock), AVT_Type, MEMF_SHARED, TAG_DONE);
if (isem->accesslock == NULL) {
__set_errno(ENOMEM);
RETURN(-1);
return -1;
}
InitSemaphore(isem->accesslock);
etc.
Through we test this way, and i have even more crashes even when just testing pure threading code without network involved, so that need invistigating.
For now will try to debug 2 possibilities about which you talk about.
EDIT: on of minetest authors says "Yes, it sounds like you need to find out what's wrong with your semaphore implementation before Minetest can start working correctly. If you have C++20 support in your toolchain you could look up std::counting_semaphore and compare its implementations."
Not sure through how/what it mean
Edited by kas1e on 2022/5/13 8:43:08