Skip to main content
gamedev.net
🔒 Locked

Another thread question

Started by OklyDokly 0 replies 200+ views
Original Post
OklyDokly
OklyDokly
What is the best way of transferring data across threads? I''m currently using a singleton class which sets up another thread and the child thread receives data from inside the singleton class, however I suspect that this is dangerous, and I don''t think it''s working for large chunks of data. I need to transfer a large string (about 50,000 bytes) from one thread to another, and am wondering how to do it.
Shannon Barber
Shannon Barber
The entire point of threads is that they are all in the same memory space. You can use any memory and any data structure you want to share information between threads. Queue''s are common (be sure to lock access with a mutex).

You can just send a pointer to the string.
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.