Multi-Thread Support
- All WD basic layer interfaces are not locked. Each WD queue instance cannot be accessed by multiple thread contexts at the same time. If multiple threads invoke the interface functions of the same WD queue instance, the mutex mechanism must be used to ensure that the invoking is serial.
- In Default Scenario, wd_send and wd_recv are invoked in serial pairing mode. In multi-thread scenarios, they may not be invoked in serial pairing mode. Whether wd_send and wd_recv support unpaired serial invoking depends on the hardware model. Because the processing of each request in the hardware processing model of the Kunpeng 920 accelerator has a context identifier, if the applied queue is allocated from the Kunpeng 920 accelerator, wd_send and wd_recv do not need to be paired for serial invoking. For example, you can invoke wd_send for multiple times and then invoke wd_recv to receive the response of a request. In this case, the resp parameter of wd_recv must point to the context of the request, and the hardware accelerator driver layer compares the context with the context of the response received by the hardware to determine whether to receive the response message.
Parent topic: WD Basic Layer Interfaces