Hello, Can anybody tell whether OpenCSD library is thread safe? I have given example code in my earlier email.
I appritiate your help. Thank you.
On Mon, Apr 20, 2020 at 3:41 PM subhasish Karmakar < subhasish.k2301@gmail.com> wrote:
Hi,
Can I use OpenCSD library in a Multi-Threaded application? I maintain decode tree handle per thread.
Code Example:/********* Initialization code *********/
//dcdtree_handle_ and p_context is maintained per thread dcdtree_handle_ = ocsd_create_dcd_tree(OCSD_TRC_SRC_FRAME_FORMATTED, OCSD_DFRMTR_FRAME_MEM_ALIGN);
ret = ocsd_dt_create_decoder(dcdtree_handle_, p_name, OCSD_CREATE_FLG_FULL_DECODER, p_cfg, &CSID);
ret = ocsd_dt_attach_packet_callback( dcdtree_handle_, CSID, OCSD_C_API_CB_PKT_MON, (void *)packetMonitorCallBack, p_context); ret = ocsd_dt_set_gen_elem_outfn( dcdtree_handle_, genTraceElemCallBack, p_context);
/********* Packet Processing *********/
//Each thread uses below function to process incoming CoreSight packet while ((bytes_done < (uint32_t)block_size) && (ret == OCSD_OK)) { if (OCSD_DATA_RESP_IS_CONT(dp_ret)) { dp_ret = ocsd_dt_process_data( dcdtree_handle_, OCSD_OP_DATA, block_index + bytes_done, block_size - bytes_done, ((uint8_t *)p_block) + bytes_done, &bytes_this_time); //Example code from
Kindly respond to my query.
Thank you, Subhasish