# Using threads and poll in nginx module

**URL:** <https://www.ruby-forum.com/t/using-threads-and-poll-in-nginx-module/242478>\
**Category:** NGINX\
**Created:** [June 26, 2015, 12:09pm UTC](https://www.ruby-forum.com/t/using-threads-and-poll-in-nginx-module/242478 "2015-06-26T12:09:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 26, 2015, 12:09pm UTC](https://www.ruby-forum.com/t/using-threads-and-poll-in-nginx-module/242478/1 "2015-06-26T12:09:35Z")

</div>

Dear all,

I run into following problem when writing a module for nginx under  
Linux.

Within my module I have to use a library which internally uses multiple  
threads (pthreads) as well as poll.

When using/calling methods of this library in main initialization  
handler of  
my nginx module everything works fine.

Problem: But when I try to execute same code within other handling  
methods  
then the library is no longer working and method calls that internally  
use  
poll and threads seems to hang forever.

So my questions are:

1. Is it possible to use a library in an nginx module that internally  
uses  
poll and multiple threads?
2. If not, is there any approach to use such a library within a nginx  
module?

Thanks for your help.  
Best regards Kline

Posted at Nginx Forum:

> **[Using threads and poll in nginx module](https://forum.nginx.org/read.php?2,259897,259897#msg-259897)**
>
> Dear all, I run into following problem when writing a module for nginx under Linux. Within my module I have to use a library which internally uses multiple threads (pthreads) as well as poll. When using/calling methods of this library in main...
