Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Anthony Williams

Pages: 1 ... 3 4 [5] 6
61
The native gcc support in the current trunk for the library facilities such as futures is listed at http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.200x. For a particular version you'll have to check your local copy of that documentation page, as the gcc website doesn't seem to list the support that shipped with each individual version.

62
I am pleased to announce the release of V1.3 of just::thread for both Ubuntu Linux and Windows.

This release includes the following changes:

  • Support for the new std::async function for launching asynchronous tasks with return values. This allows you to quickly and easily take advantage of the available hardware concurrency without excessive oversubscription.
  • Support for the new std::atomic_future class template which allows a single reference to a shared future value to be updated from multiple threads.
  • Support for 64-bit Windows has been added to the Portability Bundle
  • The <cstdatomic> header has been renamed to <atomic>
  • The std::unique_future class template has been renamed to std::future
  • Plus various other small changes to bring the code into line with the current C++0x working draft

63
I was just reading slides from a talk that are available here:

http://www.nwcpp.org/Downloads/2008/Memory_Fences.pdf

On page 16, this person asserts that on x86, the memory model enables the relaxed std::atomic conditions shown on that slide to be implemented as nothing, so there would be no performance penalty for that code (assuming the atomic types had atomic store instructions), only that the compiler be required not to reverse the orders.

My questions:
1. Is this person correct?

Yes, plain loads have acquire semantics and plain stores have release semantics on x86. Note that actually, the ordering on the data variable are superfluous and could be replaced with std::memory_order_relaxed: the operations on ready are sufficient to guarantee the ordering.

Quote
2. Would your library for Visual Studio indeed implement as no-ops?

some_atomic.load(std::memory_order_acquire) does just drop through to a simple load instruction, and some_atomic.store(std::memory_order_release) drops through to a simple store instruction. However, this instruction is wrapped in compiler directives to ensure that the compiler doesn't reorder it in a way that could break the desired semantics.

Quote
3. How does your library force the compiler not to reorder the stores?

By using appropriate compiler directives in the code. For Visual Studio 2008, _ReadWriteBarrier is used.

Anthony

64
The latest version should generate far fewer warnings.

65
This has now been fixed. All existing users should have received an email with an upgrade link. If anyone doesn't get an email, let me know and I'll send it to you again.

66
I can confirm that this does happen on Vista, but not on XP. I'll post an update when the problem has been fixed.

67
This is strange. I'll investigate and get back to you.


68
I'm glad you figured out the problem. The internal copy of the thread parameters should be cleaned up when the thread exits. Of course, if you don't join with the thread then there is no guarantee as to when that happens.

69
General Discussion about just::thread / Linux port now available
« on: August 03, 2009, 12:41:41 PM »
The linux port of just::thread is now available. Get your copy from http://www.stdthread.co.uk/order.html. Existing users please contact us for upgrade pricing.

70
Hi John,

You're not doing anything wrong; these warnings are superfluous and warn about valid code in this instance. You can disable the specific warning by adding

#pragma warning(disable:4146)

to your stdafx.h file. I'll fix it for the next build.

Anthony

71
Full documentation is now available at http://www.stdthread.co.uk/doc/

72
Support for std::vector<std::thread> will be in the 0.6 beta later this week.

73
I would agree with you on this point. so what we would need is a move aware vector list. can you post links to the necesary information so if i were to persue development of a move aware container like vector or a custom array class. I would at least have the information to do so.

The C++0x working draft is at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. std::vector is described in chapter 23.2.6.

In order to support my implementation of std::thread (and other movable types such as std::unique_future<> and std::packaged_task<>) on MSVC 2008, you will need to handle types that convert to __jss::move_emulation_t<T> differently from "normal" types and move them rather than copy them.

74
The code that requires the copy constructor is in the allocator, and is not actually used in this example, but it is required to compile. I'll see if I can figure out a way to write a custom allocator that allows this to work.

With a small amount of code, it is possible to make std::vector<std::thread> work for fixed-sized vectors, but you cannot call resize(), push_back(), erase(), insert() or clear(). You can't even call swap(). I'm not sure it's worth it - what we really need is a move-aware vector implementation.

75
the above sample would still not work. what I have found that works if I use a raw array pointer of std::thread *ptr_threads = new std::thread[ num_threads - 1 ].

the only draw back is that I have to remember to clean it up with delete [] ptr_threads.

Yes, I tried it. The code that requires the copy constructor is in the allocator, and is not actually used in this example, but it is required to compile. I'll see if I can figure out a way to write a custom allocator that allows this to work.

Pages: 1 ... 3 4 [5] 6