Hi! I noticed something odd in my application today. I wrote some code that called vEventGroupDelete, and it crashed. I discovered this is why: my heap implementation uses a mutex (it seemed like an obvious idea at the time) as a heap lock (I use the Newlib malloc/free functions with __malloc_lock and __malloc_unlock implemented on top of xSemaphoreTakeRecursive and xSemaphoreGiveRecursive respectively). vEventGroupDelete, however, calls vPortFree with the scheduler disabled, which of course fails—you can’t go to sleep to take a semaphore while the scheduler is disabled!
I notice that heap_3 in MemMang, the closest example code, suspends the scheduler while accessing the heap rather than using a mutex. However, I also noticed that the other basic synchronization primitive, the queue, does NOT try to access the heap with the scheduler disabled in vQueueDelete.
Thus my question: is this supposed to work? Is it a bug, meaning that vEventGroupDelete ought to be calling vPortFree after xTaskResumeAll? Or is this not a bug, and vPortMalloc/vPortFree must be safe to call with the scheduler disabled?