Skip to content

Commit 0e3e555

Browse files
authored
Revert "Use global queue in order to catch read event from channel"
1 parent 2f31b61 commit 0e3e555

File tree

2 files changed

+9
-18
lines changed

2 files changed

+9
-18
lines changed

src/MacVim/gui_macvim.m

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2257,26 +2257,16 @@ static int vimModMaskToEventModifierFlags(int mods)
22572257

22582258
// -- Channel Support ------------------------------------------------------
22592259

2260-
static NSMutableSet *MMChannels;
2261-
22622260
void *
22632261
gui_macvim_add_channel(channel_T *channel, int part)
22642262
{
2265-
if (!MMChannels)
2266-
MMChannels = [NSMutableSet new];
2267-
2268-
int fd = channel->ch_part[part].ch_fd;
2269-
dispatch_queue_t q =
2270-
dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
22712263
dispatch_source_t s =
2272-
dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, fd, 0, q);
2273-
[MMChannels addObject:s];
2264+
dispatch_source_create(DISPATCH_SOURCE_TYPE_READ,
2265+
channel->ch_part[part].ch_fd,
2266+
0,
2267+
dispatch_get_main_queue());
22742268
dispatch_source_set_event_handler(s, ^{
2275-
dispatch_sync(dispatch_get_main_queue(), ^{
2276-
if ([MMChannels containsObject:s]) {
2277-
channel_read(channel, part, "gui_macvim_add_channel");
2278-
}
2279-
});
2269+
channel_read(channel, part, "gui_macvim_add_channel");
22802270
});
22812271
dispatch_resume(s);
22822272
return s;
@@ -2286,7 +2276,6 @@ static int vimModMaskToEventModifierFlags(int mods)
22862276
gui_macvim_remove_channel(void *cookie)
22872277
{
22882278
dispatch_source_t s = (dispatch_source_t)cookie;
2289-
[MMChannels removeObject:s];
22902279
dispatch_source_cancel(s);
22912280
dispatch_release(s);
22922281
}

src/channel.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,11 @@ channel_gui_register_one(channel_T *channel, int part)
599599
# endif
600600
# else
601601
# ifdef FEAT_GUI_MACVIM
602+
/* Tell Core Foundation we are interested in being called when there
603+
* is input on the editor connection socket. */
602604
if (channel->ch_part[part].ch_inputHandler == 0)
603-
channel->ch_part[part].ch_inputHandler =
604-
gui_macvim_add_channel(channel, part);
605+
channel->ch_part[part].ch_inputHandler = gui_macvim_add_channel(
606+
channel, part);
605607
# endif
606608
# endif
607609
# endif

0 commit comments

Comments
 (0)