Skip to content
Snippets Groups Projects
Commit a5bad3d2 authored by Duncan Coutts's avatar Duncan Coutts Committed by Marge Bot
Browse files

Split up the CapIOManager content by I/O manager

Using the new IOMGR_ENABLED_<name> CPP defines.
parent 1a8f020f
No related branches found
No related tags found
No related merge requests found
......@@ -211,15 +211,30 @@ void initCapabilityIOManager(CapIOManager **piomgr)
(CapIOManager *) stgMallocBytes(sizeof(CapIOManager),
"initCapabilityIOManager");
#if defined(THREADED_RTS)
#if !defined(mingw32_HOST_OS)
iomgr->control_fd = -1;
switch (iomgr_type) {
#if defined(IOMGR_ENABLED_SELECT)
case IO_MANAGER_SELECT:
iomgr->blocked_queue_hd = END_TSO_QUEUE;
iomgr->blocked_queue_tl = END_TSO_QUEUE;
iomgr->sleeping_queue = END_TSO_QUEUE;
break;
#endif
#else // !defined(THREADED_RTS)
iomgr->blocked_queue_hd = END_TSO_QUEUE;
iomgr->blocked_queue_tl = END_TSO_QUEUE;
iomgr->sleeping_queue = END_TSO_QUEUE;
#if defined(IOMGR_ENABLED_WIN32_LEGACY)
case IO_MANAGER_WIN32_LEGACY:
iomgr->blocked_queue_hd = END_TSO_QUEUE;
iomgr->blocked_queue_tl = END_TSO_QUEUE;
break;
#endif
#if defined(IOMGR_ENABLED_MIO_POSIX)
case IO_MANAGER_MIO_POSIX:
iomgr->control_fd = -1;
break;
#endif
default:
break;
}
*piomgr = iomgr;
}
......@@ -376,12 +391,25 @@ void markCapabilityIOManager(evac_fn evac USED_IF_NOT_THREADS,
CapIOManager *iomgr USED_IF_NOT_THREADS)
{
#if !defined(THREADED_RTS)
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_hd);
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_tl);
evac(user, (StgClosure **)(void *)&iomgr->sleeping_queue);
switch (iomgr_type) {
#if defined(IOMGR_ENABLED_SELECT)
case IO_MANAGER_SELECT:
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_hd);
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_tl);
evac(user, (StgClosure **)(void *)&iomgr->sleeping_queue);
break;
#endif
#if defined(IOMGR_ENABLED_WIN32_LEGACY)
case IO_MANAGER_WIN32_LEGACY:
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_hd);
evac(user, (StgClosure **)(void *)&iomgr->blocked_queue_tl);
break;
#endif
default:
break;
}
}
......
......@@ -190,27 +190,25 @@ bool is_io_mng_native_p (void);
*/
typedef struct {
#if defined(THREADED_RTS)
#if !defined(mingw32_HOST_OS)
/* Control FD for the MIO manager for this capability */
int control_fd;
#if defined(IOMGR_ENABLED_SELECT)
/* Thread queue for threads blocked on I/O completion. */
StgTSO *blocked_queue_hd;
StgTSO *blocked_queue_tl;
/* Thread queue for threads blocked on timeouts. */
StgTSO *sleeping_queue;
#endif
#else // !defined(THREADED_RTS)
/* Thread queue for threads blocked on I/O completion.
* Used by the select() and Win32 MIO I/O managers. It is not used by
* the WinIO I/O manager, though it remains defined in this case.
*/
#if defined(IOMGR_ENABLED_WIN32_LEGACY)
/* Thread queue for threads blocked on I/O completion. */
StgTSO *blocked_queue_hd;
StgTSO *blocked_queue_tl;
#endif
/* Thread queue for threads blocked on timeouts.
* Used by the select() I/O manager only. It is grossly inefficient, like
* everything else to do with the select() I/O manager.
*
* TODO: It is not used by any of the Windows I/O managers, though it
* remains defined for them. This is an oddity that should be resolved.
#if defined(IOMGR_ENABLED_MIO_POSIX)
/* Control FD for the (posix) MIO manager for this capability,
*/
StgTSO *sleeping_queue;
int control_fd;
#endif
} CapIOManager;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment