For a while I was not sure on what was purpose of the EBUSY, after all sending event is not expected to be a blocking call.
But, after looking at the disassembly it makes more sense, as this prevents port disconnection and destruction from being blocking calls, potentially waiting for a sleeping PPU thread with a low priority to release port handle reference after sending an event.
This only affects sending events from userbase PPU threads, as for RSX and SPU, system PPU threads with negative priority are used.
This sort of optimization (thread-block avoidance) of the PS3 firmware is not implemented in other synchronization primitives, perhaps because event sending is done very frequantly as well as in LV1 and LV2 themselfs.
For a while I was not sure on what was purpose of the EBUSY, after all sending event is not expected to be a blocking call. But, after looking at the disassembly it makes more sense, as this prevents port disconnection and destruction from being blocking calls, potentially waiting for a sleeping PPU thread with a low priority to release port handle reference after sending an event. This only affects sending events from userbase PPU threads, as for RSX and SPU, system PPU threads with negative priority are used. This sort of optimization (thread-block avoidance) of the PS3 firmware is not implemented in other synchronization primitives, perhaps because event sending is done very frequantly as well as in LV1 and LV2 themselfs.