Hello, Pardon my ignorance but I have some questions regarding both shared memory and real-time FIFOs. Please note that all checking is omitted from examples for simplicity. 1) Using shared memory allocated by mbuf on RT side and Linux user space to share some struct, say my_struct, is there any locking involved? For example, if I have the same code in module and application as follows, both called in a loop: --------------------------------------- volatile char * shm1; ... volatile my_struct* pstruct = (volatile my_struct*) mbuff_alloc("myinterface",sizeof(my_struct)); .... pstruct = internal_struct; /*just for example, copy the whole structure at once in both directions*/ ... internal_struct = pstruct; --------------------------------------- Is there any locking involved when writing form one side to another or is it possible that either task gets "uncompletly written" structure because of the task switch? I am asking because all examples I've seen don't implement any semaphores or mutexes. If I do need to implement locking I'd be more than grateful for a simple example. 2) Using FIFOs, I suppose there is a locking declared by opening type argument and RT FIFO mechanisms. But in example: ------------------------------------------ /* rt side */ int ch_in, ch_out; /* in init_module */ ch_in = rtf_create(1, 4000); ch_out = rtf_create(2, 4000); /* in RT task function, msg is some message structure */ rtf_get (1, &msg, sizeof(msg))) == sizeof(msg)); ... rtf_put (2, &msg, sizeof(msg)); /* application side */ int fd0 = open("/dev/rtf1", O_RDONLY); int fd1 = open("/dev/rtf2", O_WRONLY); .... write(fd1, &msg, sizeof(msg)); ... n = read(fd0, buf, BUFSIZE - 1); buf[n] = 0; -------------------------------------------- Do I understand correctly if I think both read and rtf_get functions may fail on incomplete data and it is possible that I have to retry reading input later ? Is therefore line rtf_get (1, &msg, sizeof(msg))) == sizeof(msg)); more or less unusuable as I have to be sure data is complete? I can not imagine rtl_get/read will block execution of thread to wait for complete data but on the other hand it is possible that FIFO's data counter is not invalidated before the last byte is written with write/rtl_put. Is this the case with RT FIFOs? Thx, goran -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/