98f Subj : Re: Linux NPTL anomally To : comp.programming.threads From : dmarkh Date : Wed Sep 28 2005 04:27 am > Sounds like either a bug in the kernel module or a bug in the way you >are using it. It is documented to allow it to be called by a different >thread than cleans it up? The kernel module is never called by any of the threads. Functions within the kernel module are called only by the main part of the application and by other external applications. The kernel ioctl routine that registers the pid blurp: case (LCRSMEM_ID): { // identify a shared memory partition if (copy_from_user( &shm_info, (int *)arg, sizeof(lcrs_shm_info_t)) != 0) return -EFAULT; // search for an unused entry to fill for (i=0;ipid)) { // duplicate key, stale? break; } else if (lcrsmmap[i].key == 0) { // use first free entry lcrsmmap[i].pid = current->pid; lcrsmmap[i].key = shm_info.key; lcrsmmap[i].vm_start = (unsigned int)shm_info.address; lcrsmmap[i].type = shm_info.type; lcrsmmap[i].size = shm_info.size; break; } } The cleanup kernel routine blurp: int lcrsmem_release(struct inode *inode, struct file *filp) { int i; for (i=0;ipid == lcrsmmap[i].pid) { . . // code that never gets executed because the wrong pid is found . } } I realize there are other ways to do what I am doing but this should work. The current->pid in the release routine should be the pid of the main part of the app as IT is the one that calls it. None of the threads ever calls any functions of this kernel module and at the release point all the threads have long since exited anyway. Mark . 0