Detached Threads

30 views
Skip to first unread message

pa...@rcom-software.com

unread,
Jan 1, 2021, 7:26:31 PMJan 1
to libuv
What is the right way to create a detached thread and insure resources
are released upon termination under Libuv ?

pa...@rcom-software.com

unread,
Jan 13, 2021, 7:12:07 PMJan 13
to libuv
Hi Folks:

Nobody commented on my question about spawning detached thread tasks.
Consequently, I looked at the code in src/unix/thread.c and discovered
pthread_create() does not have provisions for spawning a detached thread.

The routine in the attached file spawns a detached thread correctly on Unix/Linux
systems and works under fairly heavy testing. However, I am not sure it
is in line with the Libuv implementation conventions, and it is certainly
not elegant nor of optimal modularity.

I leave it up to the Libuv implementors to come up with a more complete
solution.

Best Regards,

Paul R.
detached_thread.c

Iñaki Baz Castillo

unread,
Jan 13, 2021, 7:28:29 PMJan 13
to li...@googlegroups.com
Paul, your questions always come with code for people to review, and now you even ask for people to provide you with better or more complete code. 

I'm afraid this is like asking for free consultancy and probably nobody here is gonna do that.

Please, make specific questions about libuv.

--
You received this message because you are subscribed to the Google Groups "libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libuv+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libuv/e616b72c-8a93-4cab-ab11-2031fe7c32adn%40googlegroups.com.

Paul Romero

unread,
Jan 13, 2021, 7:53:04 PMJan 13
to li...@googlegroups.com
Hi  Inaki:

My question was just about a kind of functionality which was not addressed by the Libuv
documentation, and upon investigation turned out to be missing. As I did not design or
write Libuv, I don't consider it my responsiblity to implement missing features. But perhaps,
there is a valid reason why detached threads are not implemented in Libuv.

The code attached to my previous message is just a courtesy to the Libuv implementors.

Best Regards,

Paul R.


You received this message because you are subscribed to a topic in the Google Groups "libuv" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/libuv/mppWqd5SY7U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to libuv+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libuv/CALiegfkEhkEg-5DCXuLaf9x9ao%3DbP3nDYzNnU4fnNHscdr7vvg%40mail.gmail.com.

-- 


Paul Romero
-----------
RCOM Communications Software
EMAIL: pa...@rcom-software.com
PHONE: (510)482-2769




Iñaki Baz Castillo

unread,
Jan 13, 2021, 7:58:11 PMJan 13
to li...@googlegroups.com
On Thu, 14 Jan 2021 at 01:53, Paul Romero <pa...@rcom-software.com> wrote:
> As I did not design or
> write Libuv, I don't consider it my responsiblity to implement missing features.

I don't know what to say about that, really.


> The code attached to my previous message is just a courtesy to the Libuv implementors.

This is not how things work. People, even those who did not "design or
write libuv" create Pull Requests with bug fixes or new features.


--
Iñaki Baz Castillo
<i...@aliax.net>

Jameson Nash

unread,
Jan 13, 2021, 8:03:54 PMJan 13
to libuv
The functionality is already present in libuv master as `uv_thread_detach`

--
You received this message because you are subscribed to the Google Groups "libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libuv+un...@googlegroups.com.

Paul Romero

unread,
Jan 13, 2021, 8:33:49 PMJan 13
to li...@googlegroups.com

pa...@rcom-software.com

unread,
Jan 14, 2021, 1:17:28 PMJan 14
to libuv
I started my experiments with Libuv using the version in  libuv-1.40.0.tar .gz which, I think,
is quite a bit behind the latest version.  That is the reason I didn't find uv_thread_detach()
which has detached thread functionality.

pa...@rcom-software.com

unread,
Feb 15, 2021, 2:24:15 PMFeb 15
to libuv
Hi Folks:

What is the latest version or the best way to identify the latest version of Libuv ?

Best Regards,

Paul R.

Iñaki Baz Castillo

unread,
Feb 15, 2021, 3:05:05 PMFeb 15
to li...@googlegroups.com

pa...@rcom-software.com

unread,
Feb 15, 2021, 4:42:18 PMFeb 15
to libuv
Hi Folks:

1.41 appears to be the latest version and doesn''t seem to have uv_thread_detach(). Comments on the Internet suggest it
is in the master version.  How do I donwload the latest stable version of the master ?

Best Regards,

Paul R.

Iñaki Baz Castillo

unread,
Feb 15, 2021, 5:05:15 PMFeb 15
to li...@googlegroups.com
Those are basic GIT questions. This is not a forum about that. 

pa...@rcom-software.com

unread,
Feb 15, 2021, 5:57:30 PMFeb 15
to libuv
OK, I determined that v1.41 is the latest version with the git tools and it doesn't have uv_thread_detach(). So I'm confused about
which version has uv_thread_detach(). Am I missing something ?

PR

Jameson Nash

unread,
Feb 15, 2021, 6:00:34 PMFeb 15
to libuv
v2 (aka master)

Reply all
Reply to author
Forward
0 new messages