Re: cups-browsed uses GMainLoop and global variables, how to introduce locks against race conditions?

2016-12-08 Thread Ted Gould
On Wed, 2016-12-07 at 17:39 -0200, Till Kamppeter wrote: > On 12/02/2016 04:13 PM, Till Kamppeter wrote: > > The way how cups-browsed works is the following: > > > > First, a GMainLoop is created: > > > > gmainloop = g_main_loop_new (NULL, FALSE); > > > > Browsing for legacy CUPS broadcasts is a

Re: cups-browsed uses GMainLoop and global variables, how to introduce locks against race conditions?

2016-12-07 Thread Till Kamppeter
On 12/02/2016 04:13 PM, Till Kamppeter wrote: The way how cups-browsed works is the following: First, a GMainLoop is created: gmainloop = g_main_loop_new (NULL, FALSE); Browsing for legacy CUPS broadcasts is attached to the mail loop via GIOChannel *browse_channel = g_io_channel_unix_new

Re: cups-browsed uses GMainLoop and global variables, how to introduce locks against race conditions?

2016-12-02 Thread Till Kamppeter
On 12/02/2016 02:28 PM, Ted Gould wrote: On Fri, 2016-12-02 at 12:58 -0200, Till Kamppeter wrote: The solution would be to acquire a lock when starting to manipulate the printer list and releasing the lock when done. Now my qestion is, which functions I have to use for acquiring and releasing l

Re: cups-browsed uses GMainLoop and global variables, how to introduce locks against race conditions?

2016-12-02 Thread Ted Gould
On Fri, 2016-12-02 at 12:58 -0200, Till Kamppeter wrote: > The solution would be to acquire a lock when starting to manipulate > theĀ  > printer list and releasing the lock when done. > > Now my qestion is, which functions I have to use for acquiring andĀ  > releasing locks when using GLib and GMain

cups-browsed uses GMainLoop and global variables, how to introduce locks against race conditions?

2016-12-02 Thread Till Kamppeter
Hi, cups-browsed is a daemon which automatically creates local print queues when it discovers remote printers on the network. For this it has to observe different sources for appropriate events: - Bonjour: For IPP network printers and for remote CUPS queues of CUPS 1.6.x or newer - Legacy C