Another Thread Question...

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

Hi all,

If I use Threads and some Memory Banks do I need to take
different #Memory Banknumbers for each Thread, or not?

My Problem is the following:
I create a Dll, where the calling App creates a thread, each time, a Procedure is called. Now I need some Memory in this Procedure.

Are those #Memory-Numbers shared between the Treads, or can i just use the same for them all?

Thanks,

Timo

--------------------------------
Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs and the universe trying to produce bigger and better idiots.

...So far, the universe is winning.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Yes, all ID are global. All is shared.

Fred - AlphaSND
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

@Freak:

Why not using the WinAPI Command GlobalAlloc_(), so you do not have to use and IDs. It returns a pointer directly to your reserved mem.

I think this is more comfortable.

Mike

Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
System: Windows 2000 Server, 512 MB Ram, GeForce4200 TI 128 MB DDR, Hercules Theater 6.1 DTS Sound
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by freak.

> Yes, all ID are global. All is shared.

That's not really good, when it comes to threads. You cant't use Arrays, Linked Lists, MemoryID's... (only with mutex stuff)

So I thing, i'm going to use Global_Alloc_() instead.

Thanks for answering...

Timo
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fred.

Once you have an idea, you can use it safely with the thread.. Anyway, I will soon change all the memory allocation stuff and remove the banks, as it's lowlevel enough.

Fred - AlphaSND
Post Reply