Hi all, If I understand correctly the POSIX standard, events using SIGEV_THREAD notification should behave as threads created using pthread_create. Quoting the standard:
---- QUOTE BEGIN ---- Multi-threaded programs can use an alternate event notification mechanism. When a notification is processed, and the sigev_notify member of the sigevent structure has the value SIGEV_THREAD, the function sigev_notify_function is called with parameter sigev_value. The function shall be executed in an environment as if it were the start_routine for a newly created thread with thread attributes specified by sigev_notify_attributes. If sigev_notify_attributes is NULL, the behavior shall be as if the thread were created with the detachstate attribute set to PTHREAD_CREATE_DETACHED. Supplying an attributes structure with a detachstate attribute of PTHREAD_CREATE_JOINABLE results in undefined behavior. The signal mask of this thread is implementation-defined. --- QUOTE END ---- However, in Nuttx, the functions are sent to the work queues, which are tasks which do not belong to the same task group as the main task so the file descriptors are not shared. This makes it difficult to implement code that reads from a file (device node) when a timeout happens. I think this is a deviation from the POSIX standard, is there any kind of document listing known deviations? Possible solutions: - Create another work queue for timers which belongs to the same task group as the main task. - Use nx_pthread_create internally for notification actions instead of work queues. Thoughts? BR Carlos -- Carlos Sanchez (he, him, his) Geotab Embedded Systems Developer Team Lead | Europe Visit www.geotab.com Twitter | Facebook | YouTube | LinkedIn