mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #2539 from yogpan01/irq-context
Fix for https://github.com/ARMmbed/mbed-os-example-client/issues/75pull/2555/head
commit
390cfc402d
|
@ -31,8 +31,16 @@
|
|||
|
||||
#define TRACE_GROUP "mClt"
|
||||
|
||||
#ifdef MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
|
||||
#define MBED_CLIENT_EVENT_LOOP_SIZE MBED_CONF_MBED_CLIENT_EVENT_LOOP_SIZE
|
||||
#else
|
||||
#define MBED_CLIENT_EVENT_LOOP_SIZE 1024
|
||||
#endif
|
||||
|
||||
int8_t M2MConnectionHandlerPimpl::_tasklet_id = -1;
|
||||
|
||||
static MemoryPool<M2MConnectionHandlerPimpl::TaskIdentifier, MBED_CLIENT_EVENT_LOOP_SIZE/64> memory_pool;
|
||||
|
||||
extern "C" void connection_tasklet_event_handler(arm_event_s *event)
|
||||
{
|
||||
tr_debug("M2MConnectionHandlerPimpl::connection_tasklet_event_handler");
|
||||
|
@ -74,7 +82,7 @@ extern "C" void connection_tasklet_event_handler(arm_event_s *event)
|
|||
break;
|
||||
}
|
||||
if (task_id) {
|
||||
free(task_id);
|
||||
memory_pool.free(task_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +153,7 @@ bool M2MConnectionHandlerPimpl::resolve_server_address(const String& server_addr
|
|||
_server_port = server_port;
|
||||
_server_type = server_type;
|
||||
_server_address = server_address;
|
||||
TaskIdentifier* task = (TaskIdentifier*)malloc(sizeof(TaskIdentifier));
|
||||
TaskIdentifier* task = memory_pool.alloc();
|
||||
if (!task) {
|
||||
return false;
|
||||
}
|
||||
|
@ -248,7 +256,7 @@ bool M2MConnectionHandlerPimpl::send_data(uint8_t *data,
|
|||
return false;
|
||||
}
|
||||
|
||||
TaskIdentifier* task = (TaskIdentifier*)malloc(sizeof(TaskIdentifier));
|
||||
TaskIdentifier* task = memory_pool.alloc();
|
||||
if (!task) {
|
||||
free(buffer);
|
||||
return false;
|
||||
|
@ -310,9 +318,7 @@ int8_t M2MConnectionHandlerPimpl::connection_tasklet_handler()
|
|||
|
||||
void M2MConnectionHandlerPimpl::socket_event()
|
||||
{
|
||||
tr_debug("M2MConnectionHandlerPimpl::socket_event()");
|
||||
|
||||
TaskIdentifier* task = (TaskIdentifier*)malloc(sizeof(TaskIdentifier));
|
||||
TaskIdentifier* task = memory_pool.alloc();
|
||||
if (!task) {
|
||||
_observer.socket_error(M2MConnectionHandler::SOCKET_READ_ERROR, true);
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue