flat assembler
Message board for the users of flat assembler.

Index > Heap > thread safe vs non-thread safe,what are the differences

Author
Thread Post new topic Reply to topic
sleepsleep



Joined: 05 Oct 2006
Posts: 8906
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
most of da time we could see people release stuff in ts and non-ts download,what are da differences actually? In terms of assembly language term?
Post 29 Aug 2009, 21:37
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Means that the code ensures no errors will occur product of two or more threads concurrently executing the same code, while the non-TS will do nothing against such situations and you'll have to synchronize the access to it yourself.

Internally it may be implemented by either using OS synchronization features or using atomic CPU instructions.

In threads created by r22 you can see examples of thread-safe stack and queue code that use a CPU only approach rather than relaying on OS features.
Post 29 Aug 2009, 21:56
View user's profile Send private message Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8906
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
thanks, i think i got some idea now about these ts and non-ts stuff.
Post 30 Aug 2009, 20:41
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7725
Location: Kraków, Poland
Tomasz Grysztar
As a rule of thumb, if you avoid using any global variables and self-modyfing code, your code should be thread safe. Of course, unless you call something that is not thread safe from within this code.
Post 30 Aug 2009, 21:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.