Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7566789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:30:11+00:00 2026-05-30T14:30:11+00:00

I am trying to get into programming with D and I have come across

  • 0

I am trying to get into programming with D and I have come across something of a problem. I started off using the core.thread Thread class which provides support for starting a thread and then joining the current thread to it. D seems to want people to use message passing instead of lock/synchronization methods so I thought I’d give it a try, but every example of message passing I see needs the tid which I can’t seem to get from the Thread class. The code examples I see online actually use spawn which returns the tid instead of using the Thread wrapper, and then you use the tid to pass messages to the Thread. But now there doesn’t seem to be any way to join to a thread based on its tid! And not only that but you don’t seem to be able to spawn off a delegate, which requires me to add an unnecessary level of indirection.

So my question is first of all, why are there two completely different flavors of threading? And second of all, why are they both so incomplete when together they provide basically everything you could need?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T14:30:12+00:00Added an answer on May 30, 2026 at 2:30 pm

    core.thread provides the basic, low-level primitives for threading. std.concurrency uses core.thread internally. A tid can only be gotten from std.concurrency.spawn.

    So my question is first of all, why are there two completely different flavors of threading?

    You might as well ask, why are there two ways to write code, normal D and inline assembly code. There’s high(er) level and low level.

    And second of all, why are they both so incomplete when together they provide basically everything you could need?

    They’re not incomplete, but your multithreading must be designed to work in one or the other. If std.concurrency allowed arbitrary access to Threads and such, the guarantees it makes might not be so strong.

    To answer your more specific questions, it takes a function and not a delegate because a delegate takes a context pointer, which allows for mutation, which would break some of std.concurrency‘s assumptions. Note that spawn doesn’t allow arguments that have mutable indirection, so the no delegates thing shouldn’t be shocking.

    And instead of joining, you’d send a “stop” message to your thread. Again, this is higher level, and uses higher level constructs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to VB programming and have come across an problem:( after a
I'm trying to get into C++ programming, and I'm quite struggling against the little
I'm trying, desperately, to get into C++ programming with DirectX. It's been a steep
I was trying to get Matz and Flanagan's Ruby Programming Language metaprogramming chapter into
I've been trying to get into F# on and off for a while but
I am trying to get into android development, after some reading i have settled
I have started looking into iPhone game programming. I want to build a game
I've been trying to get into C++ programming with Eclipse, but I'm having problems
i'm trying to get into opengl programming, but fail to compile my first very
I'm trying to get into the habit of using one editor (gVim 7.3 on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.