#42 Acquire doesn't like mutex in structs

compiler
closed-rejected
John Hansen
NBC (24)
5
2007-10-18
2007-10-18
Anonymous
No

Hi,

Im working on GNU/Linux with nbc 1.0.1 b32 (the last).
When i do something like that:

struct s{
mutex m;
};

task main(){

s s1;

Acquire(s1.m);
Release(s1.m);
}

Then, the compiler says:

nbc test.nxc
# Error: Undefined Identifier __main__7qG2__s1__7qG2__000.m
File "/home/lab/test.nxc" ; line 8
# Acquire(s1.m)
#----------------------------------------------------------
# Error: Undefined Identifier __main__7qG2__s1__7qG2__000.m
File "/home/lab/test.nxc" ; line 9
# Release(s1.m)
#----------------------------------------------------------

There is anything that i'm doing wrong or it's a bug?

Thanks for your time.

Discussion

  • John Hansen
    John Hansen
    2007-10-18

    • status: open --> closed-rejected
     
  • John Hansen
    John Hansen
    2007-10-18

    Logged In: YES
    user_id=661666
    Originator: NO

    Mutex variables are not allowed to be contained in aggregates of any kind (structs or arrays). They cannot be used as function arguments either. I will see if I can make the compiler complain at the point of the declaration instead of the way it works right now.

    John Hansen