The union sigval has the following members:
int sival_int; // a simple integer value
void *sival_ptr; // a pointer
The sival_in met my needs, but I then got curious as to how one would/could use the pointer value instead. According to the documentation, sival_ptr enables the sending process to send a pointer to the receiving process. This confused me at first glance because both processes would have their own address space, so an address in one is not the same in another. One possiblitly could be if the two processes had a shared memory region between them. But even then, I might just pass an index to that region (via the sival_int) union member and have the receiving process then go lookup the correct address of the shared memory address.
Anyone have any experiance with sival_ptr ? Any idea what the original intent of this field was ?
Anyone have any experiance with sival_ptr ? Any idea what the original intent of this field was ?
1 comment:
My guess would be for in-process use of signals (somewhat like the use of signals for "alarm" notifications), where you wanted to communicate something like the address of some buffer/object/whatever that was ready for use.
Alternatively, this could be for indicating control/data registers for hardware access that tied to a given address in memory.
But I would bet that most folks aren't using this option for much....
Post a Comment