CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: MrMojoRisin

Page 1 of 2 1 2

Search: Search took 0.03 seconds.

  1. Re: Unexplained multithread behavior. Using Events.

    Hi all,

    Thanks for all of the replies. I just tested Lindley's suggestion and it seems to be working fine. As such, although I appreciate the additional suggestions, I'm going to stick with this...
  2. Re: Unexplained multithread behavior. Using Events.

    The producer should wait for the consumers to finish reading the data before overwriting. The consumers should all read the active data at once, then all do some hardware output stuff. Once the...
  3. Re: Unexplained multithread behavior. Using Events.

    Thanks again Lindley for the thorough explanation. I will give the above a try and report back.

    @Arjay: no consumer thread actually changes the original data. They are strictly readers. The...
  4. Re: Unexplained multithread behavior. Using Events.

    I tried the bool idea, but it seems with that method my consumer threads do not loop fast enough, as they're waiting on their respective bools. Each thread's loop should take the exact same time due...
  5. Re: Unexplained multithread behavior. Using Events.

    Thanks to both of you for the sound advice.

    However, I have one final concern, and I'm sorry for not making it clear earlier: each consumer thread reads the same data (and does different stuff...
  6. Re: Unexplained multithread behavior. Using Events.

    GeoRanger,

    Thanks for the reply. I agree with resetting readme_event in my consumer thread, but the issue is, as I stated in my reply to Lindley, I actually have five consumer threads (although...
  7. Re: Unexplained multithread behavior. Using Events.

    Hi Lindley,

    Thanks a lot for the quick reply. I see your point about the consumer thread being unbounded until the producer hits ResetEvent. That's one of the things I was considering. Also, I...
  8. Unexplained multithread behavior. Using Events.

    Hi all,

    I apologize for the length of the following post, but I've been banging my head against the wall for a couple of weeks trying to figure this out. I would really appreciate any advice that...
  9. Re: Why must one point to memory stored on the heap?

    Thanks all for the replies. I understand it better now.
  10. Why must one point to memory stored on the heap?

    Hi all,

    I'm curious as to why one must always declare a pointer to memory on the heap but not to memory on the stack. For example, when I declare something with the "new" keyword, it goes on the...
  11. Replies
    6
    Views
    907

    Re: Deleting pointers issue

    What I still find odd is that if I comment out delete evt, leaving delete info in there, the code will execute and exit properly. There will be no errors or crashing. Here's what I mean:

    ...
  12. Replies
    6
    Views
    907

    Re: Deleting pointers issue

    Thanks for the reply. That's exactly right. For some reason I was thinking for the past hour that calling delete deleted the pointer itself, not the memory pointed to by the pointer...but that would...
  13. Replies
    6
    Views
    907

    Deleting pointers issue

    Hi all,

    When I try to delete some pointers the computer makes a noise like there's an error and then execution just halts. The program just sits there.

    I suspect that this is a debug assertion...
  14. Re: Vector iterator: how to not iterate to end?

    Oh I see you already stated that in a previous post. Sorry for that.

    Thanks again.
  15. Re: Vector iterator: how to not iterate to end?

    Alright that makes sense, thanks. The timing complexity stuff is interesting. I assume the + operator has a complexity of O(1)?
  16. Re: Vector iterator: how to not iterate to end?

    Thanks for the quick and thorough replies everyone. I wasn't aware it was as simple as just saying "iter + 20".

    Does that method work because iter is simply a pointer to the first element of the...
  17. Vector iterator: how to not iterate to end?

    Hi all,

    I'd like to iterate through a vector but only iterate through a certain number of elements. I'm unsure of how to do this. E.g. I have a vector of size 30 yet I only want to iterate through...
  18. Replies
    15
    Views
    9,349

    Re: Assigning value to a volatile string

    Thanks for the reply. I understand what you're saying, and I most certainly cannot argue about what's in the C++ standard, but I'm still hung up about this, from Richard.J's link...
  19. Replies
    15
    Views
    9,349

    Re: Assigning value to a volatile string

    I guess I'm confused a bit now as to which strategy to use, as there seem to be a couple opposing views here. Although this is an interesting discussion, maybe I should better describe what I'm...
  20. Replies
    15
    Views
    9,349

    Re: Assigning value to a volatile string

    Based on what I've read these were my thoughts too. I'm doing this because I have some program where I need to read in a string from cin, or something similar, in one thread, and access it from...
  21. Replies
    15
    Views
    9,349

    Assigning value to a volatile string

    Hi,

    I've been trying this for awhile and I'm just about to give up and use volatile char* instead. I cannot even get this to work with a simple example. What am I missing?

    Here's the most...
  22. Replies
    24
    Views
    7,375

    Re: Declare class pointer with or without new

    Interesting discussion in the articles linked and the post above. Thanks for providing the links.

    So is it safe to say the use of new should be minimized for multiple reasons, one major reason...
  23. Replies
    24
    Views
    7,375

    Re: Declare class pointer with or without new

    Sorry, I figured out the problem; the pointer is indeed uninitialized so any attempts to get anything from it leads to a seg fault. So never mind.
  24. Replies
    24
    Views
    7,375

    Declare class pointer with or without new

    Hi all,

    What are the disadvantages to declaring a C++ class pointer without the new operator? E.g. situation 1:


    MyClass* myClass;

    Situation 2:
  25. Replies
    2
    Views
    621

    Re: Implementing virtual function issue

    Wow I knew it was something silly. Thanks a lot for the help.
Results 1 to 25 of 32
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured