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

  • SEARCH
  • Home
  • 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 6069401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:49:07+00:00 2026-05-23T09:49:07+00:00

This is a threading question where I basically started making a library thread-safe. My

  • 0

This is a threading question where I basically started making a library thread-safe. My use-case is as follows –

struct <>
    {

      int thread_specific_value;
}

1) Spin 5 threads for example.

2) Each thread does operation and store thread_specific_value in the above data structure for example. This is dynamically allocated at the initialization of each thread and added to QThreadStorage.

3) Once all threads return to main thread, I like to access the errno values of all threads and do some processing. Before I delete the thread from the main thread, can I get the information of its storage data and store in main thread’s specific storage.

In nutshell, how can I iterate through QThreadStorage of all the thread specific stored data and do some processing from main thread?

  • 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-23T09:49:08+00:00Added an answer on May 23, 2026 at 9:49 am

    Data stored in QThreadStorage is accessible only from the thread that put it there. Period. If you want to access the same data from other threads, you must store it additionally elsewhere. In particular, the thread-specific value is destroyed on thread exit; if you want to keep the value, save it somewhere before the thread exits.

    In short, don’t try to use QThreadStorage for inter-thread communication. That’s not what it’s there for.

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

Sidebar

Related Questions

this kind of follows on from another question of mine. Basically, once I have
I am doing something like this in python class MyThread ( threading.Thread ): def
This is a follow up to: this question Basically, I have a server loop
this is more of a fundamental question at how apache/threading works. in this hypothetical
This question is for those of you who, unlike myself, truely understand multi-threading in
This question is very similar to one I recently asked: Python threading- returning control
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) {
This might seem like a stupid question I admit. But I'm in a small
This is a difficult and open-ended question I know, but I thought I'd throw
This error just started popping up all over our site. Permission denied to call

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.