hallo,
what does it means "the function is not thread-safe"?
thak you in advance,
Mario. 10 3699
"_mario.lat" wrote:
what does it means "the function is not thread-safe"?
Think of a thread as a synonym for process. A process is not a program and
vice versa. There are things called "fork" and "join" where a second process
can be _spawned_. Ordinary simple programs, such as a student writes have
only a single thread or process, so the constraint would not be limiting or
interesting. But such programs are at the lower limit of complexity, at
least in this dimension.
On Sun, 27 May 2007 05:24:22 -0700, "osmium" <r1********@comcast.net>
wrote in comp.lang.c:
"_mario.lat" wrote:
what does it means "the function is not thread-safe"?
Think of a thread as a synonym for process.
Why? It is an incomplete and inadequate definition, and it does not
agree with the C standards's definition of "thread".
Oh, wait a minute, there is no C standard definition of "thread".
So why are you spewing incorrect, off-topic rubbish?
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
_mario.lat wrote:
hallo,
what does it means "the function is not thread-safe"?
The abstract C machine discussed here, don't have concurrent threads
executing. If a function depend on shared data, it will not be thread-safe
and the final result will be unpredictable in a multi-threaded program.
Check the comp.programming.threads FAQ for details.
--
Tor <torust [at] online [dot] no>
"Jack Klein" wrote:
On Sun, 27 May 2007 05:24:22 -0700, "osmium" <r1********@comcast.net>
wrote in comp.lang.c:
>"_mario.lat" wrote:
what does it means "the function is not thread-safe"?
Think of a thread as a synonym for process.
Why? It is an incomplete and inadequate definition, and it does not
agree with the C standards's definition of "thread".
Oh, wait a minute, there is no C standard definition of "thread".
So why are you spewing incorrect, off-topic rubbish?
Number 1. Because it's an immoderate group and I wanted to. Is that so
hard to figure out? Or was it a rhetorical question? The OP may get more
and better help out of the link appended here, it is more complete.
Number 2. I thought the Wikipedia link he was given was remarkably
unhelpful, IIRC it started talking about threads without saying what a
thread is. I thought what I said might possibly be more helpful than
harmful. Since about 70% of the threads on this and c.l.c++ groups are
about off-topicness, do not top post, snip signatures, do not snip
attributions, signatures must be introduced by --, no more than four lines
on a signature, read the FAQ, this is off topic, and general net etiquette I
thought what I said was at least related to computers rather than a medium
for talking about computers. Do you suppse writers spend countless hours
discussing the merits of different pencils and papers? "Spew" sounds like
an unfriendly word to me so I will wish you good day. http://en.wikipedia.org/wiki/Reentrant
"osmium" <r1********@comcast.netwrites:
"Jack Klein" wrote:
>On Sun, 27 May 2007 05:24:22 -0700, "osmium" <r1********@comcast.net> wrote in comp.lang.c:
>>"_mario.lat" wrote: what does it means "the function is not thread-safe"?
Think of a thread as a synonym for process.
Why? It is an incomplete and inadequate definition, and it does not agree with the C standards's definition of "thread".
Oh, wait a minute, there is no C standard definition of "thread".
So why are you spewing incorrect, off-topic rubbish?
Number 1. Because it's an immoderate group and I wanted to. Is that so
hard to figure out? Or was it a rhetorical question? The OP may get more
and better help out of the link appended here, it is more complete.
You *wanted* to spew incorrect, off-topic rubbish? I doubt that.
Number 2. I thought the Wikipedia link he was given was remarkably
unhelpful, IIRC it started talking about threads without saying what a
thread is.
In the Wikipedia article titled "Thread-safe", the first use of the
word "thread" is a link to the article on threads.
I thought what I said might possibly be more helpful than
harmful. Since about 70% of the threads on this and c.l.c++ groups are
about off-topicness, do not top post, snip signatures, do not snip
attributions, signatures must be introduced by --, no more than four lines
on a signature, read the FAQ, this is off topic, and general net etiquette I
thought what I said was at least related to computers rather than a medium
for talking about computers. Do you suppse writers spend countless hours
discussing the merits of different pencils and papers? "Spew" sounds like
an unfriendly word to me so I will wish you good day.
<OT>
In the abstract, "threads" and "processes" are very similar; they're
things that concurrently execute code. But in the real-world
situation that the OP is probably interested in, they're very
different things. In Unix-like systems, for example, processes are
created by calling fork(); threads are created by pthread_create (or
perhaps by some routine in some other thread library). A single
process can contain multiple threads, not vice versa.
</OT>
Yes, your response did have the virtue of being related to computers,
but it was off-topic, factually incorrect, and not likely to be useful
to the OP.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
"_mario.lat" <no**@libero.itwrote in message
news:pa****************************@libero.it...
what does it means "the function is not thread-safe"?
It means that the function is likely to behave incorrectly if you call it
from multiple <OT>threads</OT>. The canonical example is strtok().
S
--
Stephen Sprunk "Those people who think they know everything
CCIE #3723 are a great annoyance to those of us who do."
K5SSS --Isaac Asimov
--
Posted via a free Usenet account from http://www.teranews.com
osmium wrote:
Since about 70% of the threads on this and c.l.c++
groups are about off-topicness, do not top post, snip signatures, do
not snip attributions, signatures must be introduced by --, no more
than four lines on a signature, read the FAQ, this is off topic, and
general net etiquette
You're a liar.
Brian
Stephen Sprunk wrote:
"_mario.lat" <no**@libero.itwrote in message
>what does it means "the function is not thread-safe"?
It means that the function is likely to behave incorrectly if you
call it from multiple <OT>threads</OT>. The canonical example is
strtok().
And threads are not processes. Threads share data space, which is
why strtok can go BOOM. However tknsplit (nee toksplit) is clean.
See recent posts here (last 4 or 5 days only).
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com
In article <46***********************@free.teranews.com>,
Stephen Sprunk <st*****@sprunk.orgwrote:
>what does it means "the function is not thread-safe"?
>It means that the function is likely to behave incorrectly if you call it from multiple <OT>threads</OT>. The canonical example is strtok().
Well, strtok() is an example of a particularly bad variant, in that
it's not even safe to interleave calls to it in different threads.
But then, it's not even safe to interleave calls to it in *one*
thread: you must finish dealing with one string before starting to
tokenise another. strtok() is not merely not re-entrant: it saves
hidden state between calls.
Functions are considered not thread safe even when things only go
wrong if you call them simultaneously. For example, malloc() might go
wrong if two calls to it simultaneously tried to update internal data
structures. In practice, implementations that provide multi-threading
also provide thread-safe implementations of most of the standard
library functions.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tee |
last post by:
Hi,
Can we use thread.start on a function that has return value?
I have a function that will take sometimes to run and it will return a
string value, and I want to use thread.start to call...
|
by: Christian Buckl |
last post by:
Hi,
I try to implement my own thread class based on POSIX threads. I want my
class to manage everything (creation of threads, exception handling...).
This includes also some functions that need to...
|
by: Luke Dalessandro |
last post by:
Code: Thread -> U
-> T
public class Thread {
protected:
thread_t _tid;
virtual void foo() = 0;
public:
// Static entry function for the internal thread
|
by: kiplring |
last post by:
Suppose a function which has Sleep() method in it. And I want to
recycle it. I made two buttons which call "Resume()" and "Suspend()".
But It doesn't work. The state of thread "t" will be...
|
by: Alfonso Morra |
last post by:
Hi,
I need help witht he sleep function as follows. I need to be write som
code to do the ff:
1. creates a new thread
2. (in the new thread), Sleep for x milliseconds
3. (in the new thread),...
|
by: Sivaraman.S |
last post by:
Hi,
I have thread declared in this way. Dim t As New Thread(AddressOf
ThreadProc). Here ThreadProc is a function with two parameters. But i am not
able to use function name with addressof, It...
|
by: Sam Learner |
last post by:
Hello everyone,
I am developping an application, I create a thread for the application
because it is about to download a large file, and wanted it to do it inside
of a thread... Now, the function...
|
by: ChrisB |
last post by:
Coming from a C/C++ background, how would I pass a function pointer to a
function? I want to write a function that handles certain thread spawning.
Here's what I'm trying to invision:
function(...
|
by: Franck |
last post by:
I am looking for a way to pass a function as parameter, NOT A
DELEGATE.
what i am trying to do is a worker process as for example of what i
want to do :
public static void...
|
by: Airslash |
last post by:
Touchy subject I know, but I'm currently trying some stuff to understand Threads better in C++.
I've read the Windows API documentation regarding Threads, and want to build a Thread class that can...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |