Error converting a pipe (Handler) to fd on vs 2003 to use with g_io_channel_win32_new_fd
- From: puzzlecracker <vehomzzz yahoo com>
- To: gtk-devel-list gnome org
- Subject: Error converting a pipe (Handler) to fd on vs 2003 to use with g_io_channel_win32_new_fd
- Date: Fri, 7 Aug 2009 08:35:49 -0700 (PDT)
Hello!
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 (On unix-like systems, I use 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 already have a working solution on linux, and now want to
make it work cross-platforms.
I also saw that it could be a visual studio issue in this thread
http://mail.nl.linux.org/xchat-discuss/2004-03/msg00177.html
Any suggestions?
--
View this message in context: http://www.nabble.com/Error-converting-a-pipe-%28Handler%29-to-fd-on-vs-2003-to-use-with-g_io_channel_win32_new_fd-tp24866976p24866976.html
Sent from the Gtk+ - Dev - General mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]