Opened 3 years ago

Last modified 3 years ago

#851 reopened bug

semaphores on MacOs cannot be initialized with 0

Reported by: ren Owned by: somebody
Priority: minor Milestone: 4-2-0 and higher
Component: dontKnow Version: 4-1-2
Keywords: Cc:

Description

bash-3.2$ Singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 4.1.1
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Feb 2018
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> system("semaphore","exists",1);
0
> system("semaphore","init",1,0);
1
> system("semaphore","get_value",1); // does not terminate
  C-c C-c^C// ** Interrupt at cmd:`system` in line:'system("semaphore","get_value",1);'
abort after this command(a), abort immediately(r), print backtrace(b), continue(c) or quit Singular(q) ?q

halt 2
bash-3.2$ Singular
                     SINGULAR                                 /  Development
 A Computer Algebra System for Polynomial Computations       /   version 4.1.1
                                                           0<
 by: W. Decker, G.-M. Greuel, G. Pfister, H. Schoenemann     \   Feb 2018
FB Mathematik der Universitaet, D-67653 Kaiserslautern        \
> system("semaphore","exists",1);
0
> system("semaphore","init",1,5);
1
> system("semaphore","get_value",1); // this works
5
> 

Change History (2)

comment:1 Changed 3 years ago by hannes

Resolution: not a bug
Status: newclosed

This is the desired behaviour: if the semaphore is non-zero, return the value, if it is zero, wait until non-zero, and return the (new) value. In the example there is no other (connected) process to set the semaphore- therefore the command "get_value" waits forever.

comment:2 Changed 3 years ago by steenpass

Resolution: not a bug
Status: closedreopened

That is wrong. What you describe would be system("semaphore", "acquire", ...) while system("semaphore", "get_value", ...) should simply return the current value of the semaphore instantaneously whatever it is. At least this is how it works under linux.

Note: See TracTickets for help on using tickets.