Re: Genode::Registry blocking(?) on for_each call

2024-02-15 Thread Zachary Zollers
> Disregard if I'm off-base here, as I'm not clear on the C++ semantics of the 
> above...
> Is it guaranteed that the "env" reference above, will be initialized 
> correctly before
> being passed to server/client ? I guess what I'm asking is, is the ctor 
> init-list executed
> first, and the "inline" inits second, or is it the reverse ?

I hadn't even thought about that! Thanks to your suggestion, I was able to 
figure out the issue. After doing to some research, I discovered C++ 
initializes members in the order they are declared in the class (regardless of 
the order they appear in the initialization list). The issue was that I was 
declaring the Child object in the Child_policy struct before I declared the 
reference to the Registry. Switching those two declarations solved the issue.

Thanks again for your help!
___
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/5T6XAI3IWLHXJ3URMZZ2BNHH7QZCSWSJ/


Re: Genode::Registry blocking(?) on for_each call

2024-02-15 Thread Cedric At TTS via users
Hi Zachary,

>Genode::Env& _env;
>Tutorial::Child server{_env, "server", _registry };
>Tutorial::Child client{_env, "client", _registry};
>Main(Genode::Env& env) : _env(env)
>{
>}

Disregard if I'm off-base here, as I'm not clear on the C++ semantics of the 
above...
Is it guaranteed that the "env" reference above, will be initialized correctly 
before
being passed to server/client ? I guess what I'm asking is, is the ctor 
init-list executed
first, and the "inline" inits second, or is it the reverse ?

In my code I tend to avoid mixing both types of init in the same class, so I'm 
not clear on what happens if they're mixed.
If that's the culprit and "env" is passed non-initialized to the children, that 
might explain the
null-pointer crash that seems to follow. Though you mention a blockage rather 
than a crash,
so I'm maybe just lookin at this wrong.

Cedric

> 
> [1] https://gist.github.com/zgzollers/48181fbc2dac6e51015602c6329593f9
> 




___
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/N6VITJJDVFHOWSYWVY64LZO7FEX6OIHC/


Re: Genode::Registry blocking(?) on for_each call

2024-02-15 Thread Sebastian Sumpf

Hello Zachary,

On 15.02.24 15:49, Zachary Zollers wrote:

Hello Genodians,

I am attempting to familiarize myself with some of the provided data 
structures. When playing around with the Registry class, I encountered an 
interesting error. [1] is a GitHub gist containing the code I am running. I am 
wanting to use the Registry class to keep track of services announced by 
children on a parent component. When looking though the Genode repository, this 
seemed to be the accepted way to do this (please correct me if I am 
misunderstanding). When I run this code, I get the following output:

Genode 23.11
87 MiB RAM and 63252 caps assigned to init
[init -> parent] Child requested session: 'PD'
Error: illegal READ at address 0x4 by pager_object: pd='init -> parent' 
thread='ep' ip=0x7acf4

I would like to pass a reference to the Registry to each instance of 
Child_policy so I can use services announced by other children. As an 
additional experiment however, I tried creating a new Registry as a class 
member for each Child_policy (see the comment at the top of the Tutorial::Child 
class). This resulted in the following output:

Genode 23.11
87 MiB RAM and 63252 caps assigned to init
[init -> parent] Child requested session: 'PD'

To me, this indicates that the for_each call is blocking. I cannot see, 
however, what would be holding the mutex before I get to this point. Any 
pointers in the right direction would be greatly appreciated :)

[1] https://gist.github.com/zgzollers/48181fbc2dac6e51015602c6329593f9


without looking much into your code, does it help to add

! 

to the  node?

Regards,

Sebastian

--
Sebastian Sumpf
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth




___
users mailing list -- users@lists.genode.org
To unsubscribe send an email to users-le...@lists.genode.org
Archived at 
https://lists.genode.org/mailman3/hyperkitty/list/users@lists.genode.org/message/DDQZJ5HPNUAEYIA22X2JND7FPGSJZTYE/