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

Search:

Type: Posts; User: dvyukov

Page 1 of 2 1 2

Search: Search took 0.05 seconds.

  1. Replies
    9
    Views
    66,281

    Re: Managing an array shared by multiple threads?

    There is not best way for that, because the idea is busted in itself.
    What is the best way to manage 100 programmers to work on a single computer? Sorry, you just need more computers.
  2. Replies
    9
    Views
    66,281

    Re: Managing an array shared by multiple threads?

    Yeah, until your own locking mechanism does not outperform those "perfectly good locks" by several orders of magnitude.
  3. Replies
    9
    Views
    66,281

    Re: Managing an array shared by multiple threads?

    mrgr8avill, you need something along the lines of:



    class request_queue
    {
    public:
    void enqueue(request* req)
    {
    bool notify = false;
  4. Re: How to manage user messege sent by PostThreadMessage

    Here is code that works:

    class CReaderThread : public CWinThread
    {
    afx_msg void OnMessageTest( WPARAM, LPARAM )
    {
    AfxMessageBox(L"MESSAGE ARRIVED");
    }

    virtual BOOL InitInstance( )
  5. Re: How to manage user messege sent by PostThreadMessage

    I do not remember already how to do that in MFC, but in WinAPI one must do something along the lines of:
    BOOL rv;
    MSG msg = {};
    while (0 != (rv = GetMessage(&msg, 0, 0, 0)))
    {
    ...
  6. Re: How to manage user messege sent by PostThreadMessage

    About AfxEndThread:
    "Call this function to terminate the currently executing thread."
  7. Re: How to manage user messege sent by PostThreadMessage

    Also I do not see where you start message loop, where you pump messages.
  8. Re: How to manage user messege sent by PostThreadMessage

    AfxEndThread() call looks a bit suspicious. What it's for?
  9. Replies
    3
    Views
    51,142

    Re: Can balanced trees be thread-safe?

    There is a technique called PCOW (partial copy-on-write), it works for any kind of recursive data structures (lists, trees). It provides serializable operations and zero-overhead 100% scalable...
  10. Re: Interlocked* API functions and "memory access semantics"

    > By "better", I'm thinking in terms of not using a keyword that was never intended for multi-threading use

    I do not use volatiles for multi-threading. I use load_consume()/store_release() for...
  11. Re: Interlocked* API functions and "memory access semantics"

    > Is the volatile cast only to ensure the compiler generates are real load/store? If so, would it be "better" to use some sort inline assembly trick to ensure the load/store is generated?

    Until...
  12. Re: Interlocked* API functions and "memory access semantics"

    > But in the video at around 24:22, it sounds like he was only referring to compiler re-ordering - in that the compiler can not reorder volatile accesses relative to other volatile access - but the...
  13. Re: Interlocked* API functions and "memory access semantics"

    >> Volatile accesses can't be reordered only relative to other volatile accesses.
    > Absolutely, and that's what I intended. I should of been more clear (via the text in red). Thanks for pointing...
  14. Re: Interlocked* API functions and "memory access semantics"

    > Is it only the Itanium that supports the acquire/release versions of these functions, or are they available on Xeons and i7s?

    Yes and No. They are implicit on Xeons and i7s. I.e. every load is...
  15. Re: Interlocked* API functions and "memory access semantics"

    > Is it only the Itanium that supports the acquire/release versions of these functions, or are they available on Xeons and i7s?

    Yes and No. They are implicit on Xeons and i7s. I.e. every load is...
  16. Re: Interlocked* API functions and "memory access semantics"

    > Is it only the Itanium that supports the acquire/release versions of these functions, or are they available on Xeons and i7s?

    Yes and No. They are implicit on Xeons and i7s. I.e. every load is...
  17. Re: Interlocked* API functions and "memory access semantics"

    > Can someone give a simple example of how this asymmetry can be used to acheive something more efficient than a full fence?

    Here is a single-producer/single-consumer queue which is based on...
  18. Re: Interlocked* API functions and "memory access semantics"

    > Dr. Breshears states loading from a volatilve variable effects an acquire fence and storing into a volatile effects a release fence

    From C++ point of view volatile have nothing to do with...
  19. Re: Interlocked* API functions and "memory access semantics"

    > Can someone explain why these two purposes are intertwined in these functions?

    Because they are almost always required at the same time.
    If they would not provide fences, then it hardly be the...
  20. Re: Interlocked* API functions and "memory access semantics"

    > From a standards perspective, volatile accesses are more like a full fence - because the compiler can't move any volatile load/store instruction before/after another.

    Nope. That's not true....
  21. Replies
    5
    Views
    42,701

    Re: anything coming for VB.Net/C#

    Start here:
    Parallel Computing with Managed Code
    http://msdn.microsoft.com/en-us/concurrency/ee851578.aspx
  22. Replies
    5
    Views
    42,701

    Re: anything coming for VB.Net/C#

    Tersteeg , ConcRT is a native API, it's of no help in the VB.Net/C# world.
    Intel Parallel Studio is also targeted at native world.

    VB.Net/C# developer may take a look at Task Parallel Library...
  23. Replies
    3
    Views
    39,238

    Re: User threads versus kernel threads

    > Tasks I presume being related to the thread pool pattern.

    Yes, a pool of kernel threads execute a set of tasks.
  24. Replies
    3
    Views
    39,238

    Re: User threads versus kernel threads

    First of all, user mode "threads" (fibers) are not actually threads in the sense that they do not allow one to utilize parallel hardware. They are useful only as a replacement for explicit state...
  25. Replies
    3
    Views
    44,018

    Re: CreateThread API

    Hannes, I believe CreateThread() is just not guaranteed to work in VB. Isn't it? Your programming system provides an API for thread creation, so use it. For example, in Visual C++ CreateThread() is...
Results 1 to 25 of 27
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured