Sean Kelly
30c5cb3f47
replacing confusing comma expression with block statement
2011-08-03 16:42:02 -07:00
Sean Kelly
55ac8b699f
Modified List(T) so the terminal put() operation is responsible for adjusting node count. Tested to still pass unittests.
2011-08-03 15:46:21 -07:00
jmdavis
09b7cf618b
Adjusting deprecation dates for a July release.
2011-07-04 01:46:26 -07:00
jmdavis
708f1c16d3
Scheduled the version of receiveTimeout which takes a long for deprecation.
2011-06-26 22:16:45 -07:00
David Nadlinger
3e01490619
Fixed an off-by-one error in mailbox size handling.
...
The List.put(ref List) overload previously didn't increment m_count for rhs.m_front itself, leading to an underflow of m_count when removing all the messages. I suppose this didn't surface so far because m_count isn't really relevant if no mailbox size limit is set.
Also, I renamed the private put() method to appendNode() to avoid confusion as it is not really an overload semantically.
2011-06-09 16:50:15 +02:00
David Nadlinger
93c41c86a3
Expose a std.concurrency bug by running its unit test with a limited mailbox size.
2011-06-09 16:49:19 +02:00
Sean Kelly
8ae8a6d9f0
added clarifying comment for why a shared static ctor is used for a local variable.
2011-05-05 14:38:18 -07:00
Sean Kelly
628aa3a255
reverting changes that are triggering a compiler failure
2011-05-05 13:23:01 -07:00
Sean Kelly
d0e52a183c
receive() now works even if thisTid() has never been called within the main thread. also applied use of Duration throughout the receiveTimeout code, since core.sync uses Duration as its native time representation internally as well.
2011-05-04 16:27:14 -07:00
Sean Kelly
f188ca8af4
Added experimental features register(), unregister(), and locate().
2011-03-18 12:35:26 -07:00
jmdavis
0c8c1af630
Added version of receiveTimout which takes a Duration.
2011-02-18 20:26:43 -08:00
Walter Bright
046e1b36db
add source links
2011-02-06 15:46:50 -08:00
Sean Kelly
94bd4f661b
Issue 4307 - spawn()'ed thread doesn't terminate
2011-02-03 15:50:37 -08:00
Sean Kelly
ecc7390670
Changed thisTid to construct a MessageBox if one doesn't exist (true for the main thread and threads created with core.thread instead of spawn). This eliminates a double construction for spawned threads or the alternative of a segfault when sending to a thread not created by spawn.
2011-01-03 01:15:22 +00:00
Don Clugston
84477a5d3e
Move Boost copyright declaration from ddoc to normal comment. Fixes ugly ddoc output.
2010-11-24 19:34:47 +00:00
Shin Fujishiro
3c048ac456
Migration of tup.field[k] to tup[k].
...
Replaced ad-hoc 'is tuple?' checks with isTuple template.
The "this._cache" change in std.range is just a workaround for bug 5046.
2010-10-13 05:39:53 +00:00
Sean Kelly
d9a37f5b47
Changed PriorityMessageException to hold a variant instead of being a template class. This is required to support priority messages received from another process, and also sidesteps a number of implementation issues with the old approach as well. The drawback is that TDPL describes prioritySend as working the old way. This change had to happen at some point however, and better now than later. Next will be to add functionality to PriorityMessageException to simplify introspection and extraction of the message contained.
...
Greatly simplified the code in places and tuned somewhat for performance as well. Normal send/receive is about 25% faster now, and prioritySend is 200 times faster (yes, 20,000%).
Added a unittest or two and verified that they still pass :-p
2010-10-08 21:19:35 +00:00
Sean Kelly
125c011249
Made LinkTerminated message work like OwnerTerminated (ie. the user can trap it in a receive call).
2010-10-08 17:36:15 +00:00
Sean Kelly
b8d0976c69
Fixed unittest hang. I thought I'd already checked in this change, but I guess not.
2010-10-08 17:31:38 +00:00
Sean Kelly
96ebdb366c
Fixed receive() so it properly handles functions accepting a Tuple argument.
2010-10-07 20:42:06 +00:00
Sean Kelly
5744b5000c
Fixed user handling of the OwnerTerminated message so it will not always throw.
2010-10-07 14:19:04 +00:00
Sean Kelly
4bfacb565c
Fixed an issue where a receive() resulting in a thrown exception caused messages to be lost.
2010-09-30 20:57:44 +00:00
Sean Kelly
e398c7b452
Fixed an issue where priority messages were being added to both the priority and the standard message queues. This improves performance by an order of magnitude or more, but still leaves priority messaging substantially slower than normal messaging. Looking for more issues.
2010-09-30 18:08:42 +00:00
Sean Kelly
0bb3ae0fe7
Eliminated use of ".field" for Tuple field access now that it's no longer necessary.
...
Fixed the occlusion detection for receive() so that functions returning a value (assumed to be bool) do not occlude following functions accepting the same parameter list.
Changed the handling of an OwnerTerminated message so that the OwnerTerminated exception will be thrown immediately on receipt instead of delaying the throw until a receive() is issued where the receive must block and wait for a new message to arrive. Since message arrival is indeterminate (ie. network latency and other factors affect how long it will take for a message to arrive), there was no provable difference between the existing guarantee and the much simpler guarantee that OwnerTerminated is not thrown until all messages have been received from the owner only. Although the early actor model didn't even require messages from a specific sender to arrive in order, experience has shown this guarantee to be too weak for practical use in many scenarios (it's equivalent to having a weak memory model in a SMP system). So std.concurrency will guarantee that all messages from a particular sender will arrive in order and thus the OwnerTerminated message will necessarily be the last message received from the receiver's owner, so when this message is encountered an OwnerTerminated exception will be thrown immediately.
Slightly changed the handling of LinkTerminated vs. OwnerTerminated messages so that an OwnerTerminated exception will always be thrown if the sender is the recipient's owner, regardless of any existing links between the processes. The link is broken if it exists though.
2010-09-23 19:41:42 +00:00
Sean Kelly
43bc41ca7a
Added core.atomic to import list.
2010-08-28 21:18:25 +00:00
Walter Bright
b8ce58ccd1
detab sources
2010-08-23 02:14:45 +00:00
Sean Kelly
3b1f4d0010
Added unit tests to verify static checking of occlusion.
2010-08-22 11:52:04 +00:00
Sean Kelly
b78bc4c59d
Bug report from Hans Fugal. The callback occlusion detection was borked for receive() and receiveTimeout(). It was failing if the final parameter was a Variant both because of an off-by-1 error and because the test should have been in a "static if" instead of just an "if" block. Unit tests forthcoming.
2010-08-22 11:37:50 +00:00
Andrei Alexandrescu
f6077da911
Commented out failing unittests on OSX. Sean, please verify, thanks.
2010-07-28 07:56:29 +00:00
Sean Kelly
69b0921f4e
Added static checking to ensure that receive() isn't passed two functions with the same argument list, and if a function accepting Variant is present, that it's the last function in the receive set.
2010-07-20 19:18:59 +00:00
Andrei Alexandrescu
432e3fdfc8
Replaced std.contracts with std.exception throughout
2010-07-04 22:09:03 +00:00
Sean Kelly
a3418211b7
Made Tid exempt from hasLocalAliasing tests until shared can properly be applied to the mbox field inside Tid. The actual implementation is safe as-is so adding the shared label is mostly to conform to the D2 way of doing things.
2010-07-02 19:14:22 +00:00
Sean Kelly
947b1cdc7c
Fixed receiveTimeout.
2010-06-30 18:32:04 +00:00
Sean Kelly
99d6af1e86
Issue 4406 - Typo (bug) in std.concurrency
...
Fixed.
2010-06-29 21:24:38 +00:00
Sean Kelly
d144aa0061
Added static checking to forbid spawn or send params containing aliases to mutable thread-local data (ie. immutable and shared are both allowed).
2010-06-23 04:52:47 +00:00
Lars T. Kyllingstad
d2ee581d50
Fix "statement is not reachable" warnings in std.concurrency.
2010-06-22 17:02:59 +00:00
Sean Kelly
ebf24cc632
This should fix the issues with sending and receiving Tuples.
2010-06-20 04:48:43 +00:00
Sean Kelly
7bd396b135
Fixed compile error for unittest. The concurrency unittest still hangs when sending an explicit tuple though, because it isn't matching correctly. Fixing that now.
2010-06-19 18:17:20 +00:00
Sean Kelly
3f20e149fc
Added a default ctor for Tuple (needed to put a Tuple in a Variant).
...
Fixed an issue with the Tuple copy ctor. It now compiles.
Added prioritySend per TDPL. Needs more testing, but it looks good so far.
2010-06-19 06:46:39 +00:00
Sean Kelly
b5fc866431
Implemented setMaxMailboxSize(). Also added docs for some functions. The receive() method is still more complicated than I'd like, mostly because of the special handling of the OwnerTerminated message.
2010-06-18 07:20:55 +00:00
Sean Kelly
534e5497e6
Changed spawnLinked so the owner relationship is preserved. The thread link takes precedence when one of the linked threads terminates, but if the link is broken (via the not yet implemented unlink() routine) then an OwnerTerminated exception will still be thrown when the owner terminates.
2010-06-16 18:48:01 +00:00
Sean Kelly
2206b4233c
Fixed compile error in spawnLinked.
2010-06-15 22:03:40 +00:00
Sean Kelly
a980bb4ec2
Added spawnLinked as an experimental feature to test bidirectional linking. A spawnLinked thread won't have an owner, but if either it or the calling process terminates a LinkTerminated exception will be thrown from receive() when called by the other. Another difference is that this exception will be thrown once message list processing has passed through enough of the queue to encounter it rather than when no valid matches were found in the queue and the caller would have to block. I'd like to change the OwnerTerminated mechanism to work the same way (ie. throw when the message is encountered rather than continue scanning the queue looking for valid messages) but this warrants further discussion.
2010-06-15 21:30:06 +00:00
Walter Bright
cd0512c962
Sean's update
2010-06-12 20:57:44 +00:00
Sean Kelly
eb019b9df3
Added owner/owned thread behavior. One bug remains where messages from an owned to an owner thread about owned thread termination aren't remoevd from the queue. Annoying, but just a leak and I'm out of time.
2010-06-12 13:13:08 +00:00
Andrei Alexandrescu
f8f1fdbd37
Eliminated spurious unittest stdout messages.
2010-06-08 17:17:20 +00:00
Sean Kelly
8ceb365740
Fixed a stupid mistake in receiveOnly.
2010-06-05 01:23:08 +00:00
Sean Kelly
d18cea855b
Fixed an issue with tid.send(). Also added ostensibly correct code for receiveOnly in a version(none) block because there appears to be a compiler bug that prevents it from working.
2010-06-04 22:49:45 +00:00
Don Clugston
f5cf7d68f4
Trivial typo in comment
2010-05-31 11:28:04 +00:00
Walter Bright
0cbbd427f2
shouldn't have a main()
2010-03-10 01:57:00 +00:00