Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Linux Device Driver: how can an ISR wake up a user-thread? Post 302388857 by agaurav on Thursday 21st of January 2010 04:21:07 PM
Old 01-21-2010
Linux Device Driver: how can an ISR wake up a user-thread?

Hi all,

Is it possible to do the following in Linux (kernel 2.6.x):

- A user-space thread goes to "sleep". Using any call/mechanism
- On a hardware generated interrupt, the Interrupt handler (ISR) "wakes" the sleeping user-thread.

I have seen wait_event() and wake_up() but it appears that the two should be both user-mode or kernel-mode. Or can they be in different spaces?

I could use complete, semaphores or queues or anything else but it appears that any kind of such synchronization requires the shared object to be either in kernel-space or user-space.

Gaurav
 

7 More Discussions You Might Find Interesting

1. Solaris

SUNWglmr -- rasctrl environment monitoring driver for i2c or SCSI device driver ?

I've been researching minimizeing Solaris 8 and found that on the web page http://www.sun.com/bigadmin/content/packagelist/s8u7PkgList/p2.html the package SUNWglmr is listed as "rasctrl environment monitoring driver for i2c, (Root) (32-bit)" while in the document "Solaris 8 minimize-updt1.pdf"... (1 Reply)
Discussion started by: roygoodwin
1 Replies

2. UNIX for Dummies Questions & Answers

Need Book for Linux Basics and Linux device driver.

hai friend, I am new to Linux, i need a book for Linux basic and Linux device driver .. plz send the book name and author(Easy to learn and mostly used by programmers) and also send the link if it is available in Net... Thank you. ... (0 Replies)
Discussion started by: sundar.lsr
0 Replies

3. Programming

how to wake up a thread that blocking at epoll_wait?

I have two threads: one maintains a thread-safe message queue (handle this queue at the beginning of every loop) and deals with tcp connections, the other one posts message to the former one. the problem is, while the former one was blocking at epoll_wait, it's not sure that how long until the... (0 Replies)
Discussion started by: cometeor
0 Replies

4. UNIX for Advanced & Expert Users

wake up user space thread from kernel space ISR

Hello, I'm searching for a proper way to let the kernel space ISR(implemented in a kernel module) wake up a user space thread on a hardware interrupt. Except for sending a real-time signal, is it possible to use a semaphore? I've searched it on google, but it seems impossible to share a... (0 Replies)
Discussion started by: aaronwong
0 Replies

5. Linux

Linux Device Driver: avoid mem copy from/to user/kernel space

I recently started working with Linux and wrote my first device driver for a hardware chip controlled by a host CPU running Linux 2.6.x kernel. 1. The user space process makes an IOCTL call with pointer to a user memory buffer. 2. The kernel device driver in the big switch-case of IOCTL,... (1 Reply)
Discussion started by: agaurav
1 Replies

6. Programming

How to sleep and wake a thread???

Hi guys, I am creating two posix threads. I have some queries, hopefully you will help me out with them 1) How can I put a thread to indefinite sleep, for indefinite time period. I am familiar with this sleep(5); for 5 second, how can I make it indefinite?? 2) How can one thread wake another... (11 Replies)
Discussion started by: gabam
11 Replies

7. UNIX for Advanced & Expert Users

Certification For Linux Device Driver Programming

Hi All, I'm looking for role change to Linux device Driver developer. My current role has no connection to Linux Device driver development and hence to support my stand i want to do a certification for the same. I have googled but couldn't found any standard certification. I have submitted... (1 Reply)
Discussion started by: kg_gaurav
1 Replies
SET_TID_ADDRESS(2)					     Linux Programmer's Manual						SET_TID_ADDRESS(2)

NAME
set_tid_address - set pointer to thread ID SYNOPSIS
#include <linux/unistd.h> long set_tid_address(int *tidptr); Note: There is no glibc wrapper for this system call; see NOTES. DESCRIPTION
For each thread, the kernel maintains two attributes (addresses) called set_child_tid and clear_child_tid. These two attributes contain the value NULL by default. set_child_tid If a thread is started using clone(2) with the CLONE_CHILD_SETTID flag, set_child_tid is set to the value passed in the ctid argu- ment of that system call. When set_child_tid is set, the very first thing the new thread does is to write its thread ID at this address. clear_child_tid If a thread is started using clone(2) with the CLONE_CHILD_CLEARTID flag, clear_child_tid is set to the value passed in the ctid argument of that system call. The system call set_tid_address() sets the clear_child_tid value for the calling thread to tidptr. When a thread whose clear_child_tid is not NULL terminates, then, if the thread is sharing memory with other threads, then 0 is written at the address specified in clear_child_tid and the kernel performs the following operation: futex(clear_child_tid, FUTEX_WAKE, 1, NULL, NULL, 0); The effect of this operation is to wake a single thread that is performing a futex wait on the memory location. Errors from the futex wake operation are ignored. RETURN VALUE
set_tid_address() always returns the caller's thread ID. ERRORS
set_tid_address() always succeeds. VERSIONS
This call is present since Linux 2.5.48. Details as given here are valid since Linux 2.5.49. CONFORMING TO
This system call is Linux-specific. NOTES
Glibc does not provide a wrapper for this system call; call it using syscall(2). SEE ALSO
clone(2), futex(2), gettid(2) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2017-09-15 SET_TID_ADDRESS(2)
All times are GMT -4. The time now is 11:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy