Skip to content

Commit f87caf9

Browse files
committed
Copy BSD sys/queue.h to shims/sys_queue.h and remove HACK around SAFE macros
1 parent e3652d6 commit f87caf9

File tree

6 files changed

+757
-85
lines changed

6 files changed

+757
-85
lines changed

src/internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ DISPATCH_EXPORT DISPATCH_NOTHROW void dispatch_atfork_child(void);
209209
#if !TARGET_OS_WIN32
210210
#include <sys/event.h>
211211
#include <sys/mount.h>
212+
#ifdef __linux__
213+
#include <shims/sys_queue.h>
214+
#else
212215
#include <sys/queue.h>
216+
#endif
213217
#include <sys/sysctl.h>
214218
#include <sys/socket.h>
215219
#include <sys/time.h>

src/io.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1782,37 +1782,17 @@ _dispatch_stream_cleanup_operations(dispatch_stream_t stream,
17821782
dispatch_operation_t op, tmp;
17831783
typeof(*stream->operations) *operations;
17841784
operations = &stream->operations[DISPATCH_IO_RANDOM];
1785-
#ifdef __LINUX_PORT_HDD__
1786-
LINUX_PORT_ERROR();
1787-
// NOT CORRECT (doesn't support removal during iteration)
1788-
TAILQ_FOREACH(op, operations, operation_list) {
1789-
if (!channel || op->channel == channel) {
1790-
_dispatch_stream_complete_operation(stream, op);
1791-
}
1792-
}
1793-
#else
17941785
TAILQ_FOREACH_SAFE(op, operations, operation_list, tmp) {
17951786
if (!channel || op->channel == channel) {
17961787
_dispatch_stream_complete_operation(stream, op);
17971788
}
17981789
}
1799-
#endif
18001790
operations = &stream->operations[DISPATCH_IO_STREAM];
1801-
#ifdef __LINUX_PORT_HDD__
1802-
LINUX_PORT_ERROR();
1803-
// NOT CORRECT (doesn't support removal during iteration)
1804-
TAILQ_FOREACH(op, operations, operation_list) {
1805-
if (!channel || op->channel == channel) {
1806-
_dispatch_stream_complete_operation(stream, op);
1807-
}
1808-
}
1809-
#else
18101791
TAILQ_FOREACH_SAFE(op, operations, operation_list, tmp) {
18111792
if (!channel || op->channel == channel) {
18121793
_dispatch_stream_complete_operation(stream, op);
18131794
}
18141795
}
1815-
#endif
18161796
if (stream->source_running && !_dispatch_stream_operation_avail(stream)) {
18171797
dispatch_suspend(stream->source);
18181798
stream->source_running = false;
@@ -1824,21 +1804,11 @@ _dispatch_disk_cleanup_operations(dispatch_disk_t disk, dispatch_io_t channel)
18241804
{
18251805
// On pick queue
18261806
dispatch_operation_t op, tmp;
1827-
#ifdef __LINUX_PORT_HDD__
1828-
LINUX_PORT_ERROR();
1829-
// NOT CORRECT (doesn't support removal during iteration)
1830-
TAILQ_FOREACH(op, &disk->operations, operation_list) {
1831-
if (!channel || op->channel == channel) {
1832-
_dispatch_disk_complete_operation(disk, op);
1833-
}
1834-
}
1835-
#else
18361807
TAILQ_FOREACH_SAFE(op, &disk->operations, operation_list, tmp) {
18371808
if (!channel || op->channel == channel) {
18381809
_dispatch_disk_complete_operation(disk, op);
18391810
}
18401811
}
1841-
#endif
18421812
}
18431813

18441814
#pragma mark -

src/queue.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,18 +1717,6 @@ _dispatch_queue_specific_queue_dispose(dispatch_queue_specific_queue_t dqsq)
17171717
{
17181718
dispatch_queue_specific_t dqs, tmp;
17191719

1720-
#ifdef __LINUX_PORT_HDD__
1721-
LINUX_PORT_ERROR();
1722-
// NOT CORRECT (doesn't support removal during iteration)
1723-
TAILQ_FOREACH(dqs, &dqsq->dqsq_contexts, dqs_list) {
1724-
if (dqs->dqs_destructor) {
1725-
dispatch_async_f(_dispatch_get_root_queue(
1726-
_DISPATCH_QOS_CLASS_DEFAULT, false), dqs->dqs_ctxt,
1727-
dqs->dqs_destructor);
1728-
}
1729-
free(dqs);
1730-
}
1731-
#else
17321720
TAILQ_FOREACH_SAFE(dqs, &dqsq->dqsq_contexts, dqs_list, tmp) {
17331721
if (dqs->dqs_destructor) {
17341722
dispatch_async_f(_dispatch_get_root_queue(
@@ -1737,7 +1725,6 @@ _dispatch_queue_specific_queue_dispose(dispatch_queue_specific_queue_t dqsq)
17371725
}
17381726
free(dqs);
17391727
}
1740-
#endif
17411728
_dispatch_queue_destroy((dispatch_queue_t)dqsq);
17421729
}
17431730

0 commit comments

Comments
 (0)