Memory Pools and fdMonitor Handler


#1

Hiya,

I need to allocate memory inside a fdMonitor Handler function when I receive data.

The memory pool documentation states:

don’t call any memory pool functions from within a signal handler

Does a fdMonitor Handler function (or any event handler function for that matter) behave as a ‘signal handler’?

BTW, I know that malloc() and friends throw a memory corruption ERROR when called with the fdHandler function…

ciao, Dave


#2

Hello,

Yes, you can allocate the memory inside fdMonitor Handler function. The fdMonitor Handler function is acts as an event handler.
The documentation is talks about do not use memory pool functions inside signal handler. Signal handler and event handler functions are totally different functions.
Signal handler functions will be trigerred when the signal event occurs. For example, Ctrl-C, Ctrl-D, Ctrl-Z, etc.

You can use memory pool functions like, le_mem_CreatePool(), le_mem_ForceAlloc(), le_mem_Release(), etc in fdMonitor Handler function.

Thanks,
Pinkesh Shah