Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > time in threaded programs

Reply
Thread Tools

time in threaded programs

 
 
Joachim Schmitz
Guest
Posts: n/a
 
      01-30-2008
Randy Howard wrote:
> On Mon, 28 Jan 2008 16:29:47 -0600, CBFalconer wrote
> (in article <(E-Mail Removed)>):
>
>> Randy Howard wrote:
>>> Ian Collins wrote
>>>> CBFalconer wrote:
>>>>> JLeidel wrote:
>>>>>>
>>>>>> time( &cur_time );
>>>>>> localtime_r( &cur_time, my_time );
>>>>>> ...
>>>>>>
>>>>>> segfaults on the `localtime_r` call.
>>>>>
>>>>> Bad call. From N869:
>>>>>
>>>> Why?
>>>
>>> Probably due to him jumping the gun again and not seeing the _r
>>> part.

>>
>> True. However I don't recall that localtime_r code was shown.

>
> It's in the article you quoted. And there it is again, for your
> convenience. Just look up ^^^

No, it's not. The call to localtime_r is shown, but not it's code.

Bye, Jojo


 
Reply With Quote
 
 
 
 
Randy Howard
Guest
Posts: n/a
 
      01-30-2008
On Wed, 30 Jan 2008 08:41:06 -0600, Joachim Schmitz wrote
(in article <fnq2a4$avh$(E-Mail Removed)>):

> Randy Howard wrote:
>> On Mon, 28 Jan 2008 16:29:47 -0600, CBFalconer wrote
>> (in article <(E-Mail Removed)>):
>>
>>> Randy Howard wrote:
>>>> Ian Collins wrote
>>>>> CBFalconer wrote:
>>>>>> JLeidel wrote:
>>>>>>>
>>>>>>> time( &cur_time );
>>>>>>> localtime_r( &cur_time, my_time );
>>>>>>> ...
>>>>>>>
>>>>>>> segfaults on the `localtime_r` call.
>>>>>>
>>>>>> Bad call. From N869:
>>>>>>
>>>>> Why?
>>>>
>>>> Probably due to him jumping the gun again and not seeing the _r
>>>> part.
>>>
>>> True. However I don't recall that localtime_r code was shown.

>>
>> It's in the article you quoted. And there it is again, for your
>> convenience. Just look up ^^^

> No, it's not. The call to localtime_r is shown, but not it's code.


*sigh*

It was code /using/ localtime_r. If you want to see what the
implementation for that looks like, fine, but that has nothing to do
with what happened earlier in this thread.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





 
Reply With Quote
 
 
 
 
Martin Ambuhl
Guest
Posts: n/a
 
      01-30-2008
Randy Howard wrote:
> On Mon, 28 Jan 2008 16:29:47 -0600, CBFalconer wrote


>> True. However I don't recall that localtime_r code was shown.

>
> It's in the article you quoted. And there it is again, for your
> convenience. Just look up ^^^


It's time you learned to read. Nowhere did CDFalconer suggest there
were no references to localtime_r. He said that he did not recall that
the localtime_r _code_ was shown. Since localtime_r is not part of
standard C, any questions about it require that its _code_ be shown or
we can't known what it is or does. Worse, there is not even a prototype
shown, so we can't even know what the arguments ought to be.
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      01-30-2008
Martin Ambuhl <(E-Mail Removed)> writes:
> Randy Howard wrote:
>> On Mon, 28 Jan 2008 16:29:47 -0600, CBFalconer wrote
>>> True. However I don't recall that localtime_r code was shown.

>>
>> It's in the article you quoted. And there it is again, for your
>> convenience. Just look up ^^^

>
> It's time you learned to read. Nowhere did CDFalconer suggest there
> were no references to localtime_r. He said that he did not recall
> that the localtime_r _code_ was shown. Since localtime_r is not part
> of standard C, any questions about it require that its _code_ be shown
> or we can't known what it is or does. Worse, there is not even a
> prototype shown, so we can't even know what the arguments ought to be.


True, but it's safe to assume that the value of an uninitialized
variable is not a valid argument. In the call shown in the posted
code fragment, one of the arguments was an apparently uninitalized
variable; just evaluating it invokes UB even before the call. (In
practice, bad things are likely to happen inside localtime_r() when it
tries to use the parameter.)

--
Keith Thompson (The_Other_Keith) <(E-Mail Removed)>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling multi-threaded programs with the GNU compiler suite Virchanza C++ 8 04-06-2011 01:00 AM
Terminating threaded programs mk Python 4 02-11-2010 08:22 PM
global variables in threaded perl programs iloveperl@abc.com Perl Misc 1 04-13-2008 12:28 AM
Programs take a long time to launch from A.Programs Me MCSE 9 01-20-2005 04:05 PM
Why do Java offers two different ways to write the multi-threaded Java programs? Rodney Edmondson Java 11 12-09-2003 03:46 AM



Advertisments