Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 328773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:31:35+00:00 2026-05-12T09:31:35+00:00

I am trying to use notify a main gtk thread ( from a separate

  • 0

I am trying to use notify a main gtk thread ( from a separate thread) that some even occurred using pipes. I get the following warning when I am trying to setup pipes. What is a good workaround?

when I can this g_io_channel_win32_new_fd, I see this warning, and thus pipe isn’t created at all 🙁

GLib-WARNING **: giowin32.c:1564: 3 isn’t a C library file descriptor

    int fds[2];
    GIOChannel* gioChannels[2];
    HANDLE rdPipe, wrPipe;
    SECURITY_ATTRIBUTES saAttr;

    saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); 
    saAttr.bInheritHandle = TRUE; 
    saAttr.lpSecurityDescriptor = NULL;
    if (CreatePipe(&rdPipe, &wrPipe, NULL, 1024)) 
    {
       fds[0]  =_open_osfhandle((gssize)rdPipe,  O_RDONLY); 
       fds[1] = _open_osfhandle((long)wrPipe,_O_APPEND);

       gioChannels[0] =g_io_channel_win32_new_fd(fds[0] );
       gioChannels[1] =g_io_channel_win32_new_fd(fds[0] );

       g_io_add_watch( gioChannels[1],(GIOCondition) (G_IO_IN | G_IO_HUP), 
                        (GIOFunc)SomeCallaback,(gpointer)this );

    }

The goal is to notify main application that something occurred in thread thread. In my case, I can’t use gtk in multi-threaded way (calling functions of main thread from spawned one), so I am trying to do it via pipes.

I also saw that it could be a visual studio issue in this thread

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:31:35+00:00Added an answer on May 12, 2026 at 9:31 am

    Like the error says, handles created by CreatePipe are not file descriptors. The Windows programming model does not use file descriptors, so you cannot normally mix and match Windows and non-Windows I/O functions. I suspect if you removed some of the casts in your code, your compiler would pinpoint the problem – C-style (or reinterpret) casrs in C++ code
    are almost always a sign you are doing something wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.