Skip to content

Commit 818ad45

Browse files
authored
Merge pull request #2 from Julian-Chu/master
Fix typos in mpmc
2 parents 4db8640 + 450ec3b commit 818ad45

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

mpmc/mpmc.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ enum queue_ops {
7474
DEQ = 1 << 0,
7575
};
7676

77-
/* regiseter the enqueuers first, dequeuers second. */
77+
/* register the enqueuers first, dequeuers second. */
7878
void mpmc_queue_register(mpmc_t *q, handle_t *th, int flag)
7979
{
8080
th->spare = mpmc_new_node();
@@ -122,8 +122,8 @@ static void *mpmc_find_cell(node_t *volatile *ptr, long i, handle_t *th)
122122
{
123123
node_t *curr = *ptr; /* get current node */
124124

125-
/* j is thread's local node'id (put node or pop node), (i / N) is the cell
126-
* needed node'id. and we shoud take it, By filling the nodes between the j
125+
/* j is thread's local node id (put node or pop node), (i / N) is the cell
126+
* needed node id. and we should take it, By filling the nodes between the j
127127
* and (i / N) through 'next' field
128128
*/
129129
for (long j = curr->id; j < i / N; ++j) {
@@ -198,8 +198,8 @@ void mpmc_enqueue(mpmc_t *q, handle_t *th, void *v)
198198
if ((cv = __atomic_exchange_n(c, v, __ATOMIC_ACQ_REL)) == NULL)
199199
return;
200200

201-
/* else the couterpart pop thread has wait this cell, so we just change the
202-
* wating value to 0 and wake it
201+
/* else the counterpart pop thread has wait this cell, so we just change the
202+
* waiting value to 0 and wake it
203203
*/
204204
*((int *) cv) = 0;
205205
mpmc_futex_wake(cv, 1);
@@ -236,7 +236,7 @@ void *mpmc_dequeue(mpmc_t *q, handle_t *th)
236236
mpmc_futex_wait(&futex_addr, 1);
237237
} while (futex_addr == 1);
238238

239-
/* the couterpart put thread has change futex_addr's value to 0. and the
239+
/* the counterpart put thread has change futex_addr's value to 0. and the
240240
* data has into cell(c).
241241
*/
242242
cv = *c;
@@ -293,7 +293,7 @@ void *mpmc_dequeue(mpmc_t *q, handle_t *th)
293293
if (new_id <= init_index)
294294
/* __atomic_store_n(ptr, val, __ATOMIC_RELEASE) is a store with
295295
* a preceding release fence to ensure all previous load and
296-
* stores completes before the current store is visiable.
296+
* stores completes before the current store is visible.
297297
*/
298298
__atomic_store_n(&q->init_id, init_index, __ATOMIC_RELEASE);
299299
else {

0 commit comments

Comments
 (0)