Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Connection.GetObject blocked in signal handler #61

@pwik

Description

@pwik

Hey,

Getting an object inside a signal handler seems to block execution on the main thread when running an Iterate loop inside a separate thread. Example:

    class MyClass
    {
        Connection connection;
        SomeObject someObject;

        public MyClass()
        {
            connection = Bus.System;

            new Thread(new ThreadStart(() =>
            {
                while (connection.IsConnected)
                {
                    connection.Iterate();
                }
            })).Start();

            someObject = connection.GetObject<SomeObject>(bus_name, objpath...);

            someObject.Callback += () =>
            {
                SomeObject2 so2 = connection.GetObject<SomeObject2>(bus_name, path...);

            }
        }
    }

When the someObject.Callback handler is called the main thread stops when trying to get the SomeObject2 object. My solution to this is to create a new thread in the signal handler and from there access SomeObject2. That seems to work just fine. Am I missing something?

Running in Mono 4.6.2 on Ubuntu 16.04.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions