Skip to content

Commit 0f28587

Browse files
committed
Merge pull request #5 from acehreli/master
Several typo fixes and other minor changes
2 parents 639fb75 + f522a90 commit 0f28587

File tree

9 files changed

+51
-50
lines changed

9 files changed

+51
-50
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![Build Status](https://travis-ci.org/dcarp/asynchronous.png?branch=master)](https://travis-ci.org/dcarp/asynchronous)
22

3-
#`asynchonous`#
3+
#`asynchronous`#
44
This library provides infrastructure for writing concurrent code using coroutines, multiplexing I/O access over sockets and other resources, running network clients and servers, and other related primitives.
55

66
*It implements most of the python 3 [asyncio API](https://docs.python.org/3/library/asyncio.html).*
@@ -17,7 +17,7 @@ Can be found at: http://dcarp.github.io/asynchronous/index.html
1717
* Locks and semaphores (done)
1818
* Queues (done)
1919

20-
####Why yet another async library? What wrong with vibe.d?####
20+
####Why yet another async library? What is wrong with vibe.d?####
2121
* `asynchronous` is a library and not a framework
2222
* it is not web-oriented, compatible with `std.socket`
2323
* arguably nicer API

dub.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "asynchronous",
3-
"description": "Asynchonous library for D",
3+
"description": "Asynchronous library for D",
44
"license": "Boost 1.0",
55
"copyright": "Copyright © 2015-2016 Dragoş Carp",
66
"authors": [

src/asynchronous/events.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ alias Protocol = asynchronous.protocols.Protocol;
2828
interface CallbackHandle
2929
{
3030
/**
31-
* Cancel the call. If the callback is already canceled or executed, this
31+
* Cancel the call. If the callback is already cancelled or executed, this
3232
* method has no effect.
3333
*/
3434
void cancel();
@@ -76,7 +76,7 @@ if (isDelegate!Dg)
7676
}
7777

7878
/**
79-
* Cancel the call. If the callback is already canceled or executed, this
79+
* Cancel the call. If the callback is already cancelled or executed, this
8080
* method has no effect.
8181
*/
8282
override void cancel()
@@ -334,7 +334,7 @@ abstract class EventLoop
334334
*
335335
* Every callback scheduled before $(D_PSYMBOL stop()) is called will run.
336336
* Callbacks scheduled after $(D_PSYMBOL stop()) is called will not run.
337-
* Howerver, those callbacks will run if $(D_PSYMBOL runForever()) is
337+
* However, those callbacks will run if $(D_PSYMBOL runForever()) is
338338
* called again later.
339339
*/
340340
final void stop()
@@ -538,7 +538,7 @@ abstract class EventLoop
538538
* overrides the hostname that the target server’s certificate will be
539539
* matched against. By default the value of the host argument is used.
540540
* If host is empty, there is no default and you must pass a value for
541-
* $(D_PSYMBOL serverHostname). If $(D_PSYMBOL serverHostname) is an
541+
* $(D_PSYMBOL serverHostname). If $(D_PSYMBOL serverHostname) is
542542
* empty, hostname matching is disabled (which is a serious security
543543
* risk, allowing for man-in-the-middle-attacks).
544544
*
@@ -556,7 +556,7 @@ abstract class EventLoop
556556
* be specified.
557557
*
558558
* localHost = if given, together with $(D_PSYMBOL localService) is used to
559-
* bind the socket to locally. The $(D_PSYMBOL localHost) and
559+
* bind the socket locally. The $(D_PSYMBOL localHost) and
560560
* $(D_PSYMBOL localService) are looked up using $(D_PSYMBOL
561561
* getAddressInfo()), similarly to host and service.
562562
*
@@ -727,7 +727,7 @@ abstract class EventLoop
727727
else
728728
{
729729
enforce(remoteHost.empty,
730-
"Remote host parameter not supportored yet");
730+
"Remote host parameter not supported yet");
731731

732732
auto addressInfos = getAddressInfo(localHost, localService,
733733
addressFamily, SocketType.DGRAM, protocolType,
@@ -846,7 +846,7 @@ abstract class EventLoop
846846
}
847847
else
848848
{
849-
enforce(socket !is null, "no path and sock were specified");
849+
enforce(socket !is null, "no path and socket were specified");
850850
enforce(socket.addressFamily == AddressFamily.UNIX,
851851
"A UNIX Domain Socket was expected, got %s".format(socket));
852852
socket.blocking(false);
@@ -865,7 +865,7 @@ abstract class EventLoop
865865
//path is a str, representing a file systsem path to bind the
866866
//server socket to.
867867

868-
//sock can optionally be specified in order to use a preexisting
868+
//socket can optionally be specified in order to use a preexisting
869869
//socket object.
870870

871871
//backlog is the maximum number of queued connections passed to

src/asynchronous/libasync/events.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ package class LibasyncEventLoop : EventLoop
214214
ProtocolType protocolType = UNSPECIFIED!ProtocolType,
215215
AddressInfoFlags addressInfoFlags = UNSPECIFIED!AddressInfoFlags)
216216
{
217-
// no async implementation in libasync yet, use the std.socket.getAddresInfo implementation;
217+
// no async implementation in libasync yet, use the
218+
// std.socket.getAddresInfo implementation;
218219
return std.socket.getAddressInfo(host, service, addressFamily,
219220
socketType, protocolType, addressInfoFlags);
220221
}

src/asynchronous/locks.d

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ final class Lock
150150
* initially false.
151151
*
152152
* This class is not thread safe.
153-
*/
153+
*/
154154
final class Event
155155
{
156156
private EventLoop eventLoop;
@@ -193,7 +193,7 @@ final class Event
193193

194194
/**
195195
* Set the internal flag to true. All coroutines waiting for it to become
196-
* true are awakened. Coroutine that call $(D_PSYMBOL wait()) once the flag
196+
* true are awakened. Coroutines that call $(D_PSYMBOL wait()) once the flag
197197
* is true will not block at all.
198198
*/
199199
void set()
@@ -327,7 +327,7 @@ final class Condition
327327
/**
328328
* Wake up all coroutines waiting on this condition. This method acts like
329329
* $(D_PSYMBOL notify()), but wakes up all waiting coroutines instead of
330-
* one. If the calling coroutines has not acquired the lock when this method
330+
* one. If the calling coroutine has not acquired the lock when this method
331331
* is called, an $(D_PSYMBOL Exception) is thrown.
332332
*/
333333
void notifyAll()
@@ -388,8 +388,9 @@ final class Condition
388388
/**
389389
* Wait until a predicate becomes true.
390390
*
391-
* The predicate should be a callable returning a boolean value. The final
392-
* predicate value is the return value.
391+
* The predicate should be a callable returning a boolean value.
392+
*
393+
* Returns true
393394
*/
394395
@Coroutine
395396
bool waitFor(bool delegate() predicate)
@@ -501,7 +502,7 @@ class Semaphore
501502

502503
/**
503504
* A bounded semaphore implementation.
504-
*
505+
*
505506
* This throws an Exception in $(D_PSYMBOL release()) if it would increase the
506507
* value above the initial value.
507508
*/

src/asynchronous/queues.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class Queue(T, size_t maxSize = 0)
7474
this.eventLoop = getEventLoop;
7575
else
7676
this.eventLoop = eventLoop;
77-
77+
7878
this.finished = new Event(this.eventLoop);
7979
this.finished.set;
8080
}

src/asynchronous/streams.d

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ alias ClientConnectedCallback = void delegate(StreamReader, StreamWriter);
104104
*
105105
* The rest of the arguments are all the usual arguments to $(D_PSYMBOL
106106
* eventLoop.createServer()) except $(D_PSYMBOL protocolFactory). The return
107-
* value is the same as $(D_PSYMBOL eventLoop.create_server()).
107+
* value is the same as $(D_PSYMBOL eventLoop.createServer()).
108108
*
109109
* Additional optional keyword arguments are loop (to set the event loop
110110
* instance to use) and limit (to set the buffer limit passed to the
@@ -325,7 +325,7 @@ class StreamReaderProtocol : FlowControlProtocol
325325

326326
if (clientConnectedCallback !is null)
327327
{
328-
streamWriter = new StreamWriter(eventLoop, transport1, this,
328+
streamWriter = new StreamWriter(eventLoop, transport1, this,
329329
streamReader);
330330
eventLoop.createTask(clientConnectedCallback, streamReader,
331331
streamWriter);
@@ -370,7 +370,7 @@ final class StreamReader
370370
this.eventLoop = getEventLoop;
371371
else
372372
this.eventLoop = eventLoop;
373-
// The line length limit is a security feature;
373+
// The line length limit is a security feature;
374374
// it also doubles as half the buffer limit.
375375
this.limit = limit;
376376
}
@@ -443,7 +443,7 @@ final class StreamReader
443443
}
444444

445445
/**
446-
* Set the exception.
446+
* Set the transport.
447447
*/
448448
void setTransport(ReadTransport transport)
449449
in
@@ -487,7 +487,7 @@ final class StreamReader
487487
{
488488
// StreamReader uses a future to link the protocol feed_data() method
489489
// to a read coroutine. Running two read coroutines at the same time
490-
// would have an unexpected behaviour. It would not possible to know
490+
// would have an unexpected behavior. It would not be possible to know
491491
// which coroutine would get the next data.
492492
enforce(flowWaiter is null, functionName
493493
~ "() called while another coroutine is already waiting for incoming data");
@@ -604,8 +604,9 @@ final class StreamReader
604604
/**
605605
* Read exactly $(D_PSYMBOL n) bytes. Raise an $(D_PSYMBOL
606606
* IncompleteReadError) if the end of the stream is reached before
607-
* $(D_PSYMBOL n) can be read, the $(D_PSYMBOL IncompleteReadError.partial)
608-
* attribute of the exception contains the partial read bytes.
607+
* $(D_PSYMBOL n) bytes can be read, the $(D_PSYMBOL
608+
* IncompleteReadError.partial) attribute of the exception contains the
609+
* partial read bytes.
609610
*/
610611
@Coroutine
611612
const(void)[] readExactly(size_t n)
@@ -708,7 +709,7 @@ final class StreamWriter
708709
}
709710

710711
/**
711-
* Let the write buffer of the underlying transport a chance to be flushed.
712+
* Give the write buffer of the underlying transport a chance to be flushed.
712713
*
713714
* The intended use is to write:
714715
*
@@ -718,7 +719,7 @@ final class StreamWriter
718719
* When the size of the transport buffer reaches the high-water limit (the
719720
* protocol is paused), block until the size of the buffer is drained down
720721
* to the low-water limit and the protocol is resumed. When there is nothing
721-
* to wait for, the continues immediately.
722+
* to wait for, continue immediately.
722723
*
723724
* Calling $(D_PSYMBOL drain()) gives the opportunity for the loop to
724725
* schedule the write operation and flush the buffer. It should especially

src/asynchronous/tasks.d

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ interface TaskHandle : FutureHandle
156156

157157
if (thisTask.injectException !is null)
158158
throw thisTask.injectException;
159-
}
159+
}
160160
}
161161

162162
private class TaskFiber : Fiber
@@ -216,7 +216,7 @@ static this()
216216
* different threads. While a task waits for the completion of a future, the
217217
* event loop executes a new task.
218218
*
219-
* The cancellation of a task is different from the cancelation of a future.
219+
* The cancellation of a task is different from the cancellation of a future.
220220
* Calling $(D_PSYMBOL cancel()) will throw a $(D_PSYMBOL CancelledException)
221221
* to the wrapped fiber. $(D_PSYMBOL cancelled()) only returns $(D_KEYWORD
222222
* true) if the wrapped fiber did not catch the $(D_PSYMBOL
@@ -419,8 +419,8 @@ unittest
419419
}
420420

421421
/**
422-
* Return an generator whose values, when waited for, are Future instances in
423-
* the order in which and as soon as they complete.
422+
* Return a generator whose values, when waited for, are Future instances in
423+
* the order they complete.
424424
*
425425
* Raises $(D_PSYMBOL TimeoutException) if the timeout occurs before all futures
426426
* are done.
@@ -627,7 +627,7 @@ unittest
627627
* cancel $(D_PSYMBOL shield()).
628628
*
629629
* If you want to completely ignore cancellation (not recommended) you can
630-
* combine $(D_PSYMBOL shield()) with a try/except clause, as follows:
630+
* combine $(D_PSYMBOL shield()) with a try/catch clause, as follows:
631631
*
632632
* $(D_CODE
633633
* try
@@ -880,8 +880,8 @@ unittest
880880
*
881881
* future = future to wait for.
882882
*
883-
* timeout = can be used to control the maximum number of seconds to wait
884-
* before returning. If $(PARAM timeout) is 0 or negative, block until the
883+
* timeout = can be used to control the maximum time to wait before
884+
* returning. If $(PARAM timeout) is 0 or negative, block until the
885885
* future completes.
886886
*
887887
* Returns: result of the future. When a timeout occurs, it cancels the task
@@ -1046,7 +1046,7 @@ class GeneratorTask(T) : Task!(void delegate())
10461046

10471047
/**
10481048
* Yield a value to the caller of the currently executing generator task. The
1049-
* type of the yielded value and of type of the generator must be the same;
1049+
* type of the yielded value and the type of the generator must be the same.
10501050
*/
10511051
@Coroutine
10521052
void yieldValue(T)(auto ref T value)

src/asynchronous/transports.d

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -108,20 +108,20 @@ interface WriteTransport : BaseTransport
108108
/**
109109
* Set the high- and low-water limits for write flow control.
110110
*
111-
* These two values control when call the protocol's $(D_PSYMBOL
111+
* These two values control when the protocol's $(D_PSYMBOL
112112
* pauseWriting()) and $(D_PSYMBOL resumeWriting()) methods are called. If
113113
* specified, the low-water limit must be less than or equal to the
114114
* high-water limit.
115-
*
116-
* The defaults are implementation-specific. If only the high-water limit
117-
* is given, the low-water limit defaults to a implementation-specific value
118-
* less than or equal to the high-water limit. Setting $(D_PSYMBOL high) to
119-
* zero forces low to zero as well, and causes $(D_PSYMBOL pauseWriting())
120-
* to be called whenever the buffer becomes non-empty. Setting $(D_PSYMBOL
121-
* low) to zero causes $(D_PSYMBOL resumeWriting()) to be called only once
122-
* the buffer is empty. Use of zero for either limit is generally
123-
* sub-optimal as it reduces opportunities for doing I/O and computation
124-
* concurrently.
115+
*
116+
* The defaults are implementation-specific. If only the high-water limit
117+
* is given, the low-water limit defaults to an implementation-specific
118+
* value less than or equal to the high-water limit. Setting $(D_PSYMBOL
119+
* high) to zero forces low to zero as well, and causes $(D_PSYMBOL
120+
* pauseWriting()) to be called whenever the buffer becomes
121+
* non-empty. Setting $(D_PSYMBOL low) to zero causes $(D_PSYMBOL
122+
* resumeWriting()) to be called only once the buffer is empty. Use of
123+
* zero for either limit is generally sub-optimal as it reduces
124+
* opportunities for doing I/O and computation concurrently.
125125
*/
126126
void setWriteBufferLimits(Nullable!size_t high = Nullable!size_t(),
127127
Nullable!size_t low = Nullable!size_t());
@@ -175,8 +175,7 @@ interface DatagramTransport : BaseTransport
175175
* transport-dependent target address).
176176
*
177177
* If $(D_PSYMBOL address) is $(D_KEYWORD null), the data is sent to the
178-
* target address given on transport
179-
* creation.
178+
* target address given on transport creation.
180179
*
181180
* This method does not block; it buffers the data and arranges for it to be
182181
* sent out asynchronously.
@@ -203,7 +202,6 @@ interface SubprocessTransport : BaseTransport
203202
*/
204203
Pid getPid();
205204

206-
207205
/**
208206
* Returns: the transport for the communication pipe corresponding to the
209207
* integer file descriptor fd:

0 commit comments

Comments
 (0)