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

Commit

Permalink
Fix dei commit 68ea2a3 #19 1c25def #12
Browse files Browse the repository at this point in the history
  • Loading branch information
jjak0b committed May 20, 2020
1 parent 68ea2a3 commit f58378c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
20 changes: 9 additions & 11 deletions src/handler/shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,20 @@ int Sys6_DoIO( word command, word *devregAddr, int subdevice ) {
int *semKey = device_GetSem( devLine, devNo, subdevice );
int b_error = semKey == NULL;
pcb_t *pid = scheduler_GetRunningProcess();
if( !b_error ) {
b_error = semaphore_P( semKey, pid );

// un semaforo di un device è sempre almeno inizializzato a 0, e quindi è sempre sospeso
if( !b_error && *semKey >= 0 ){
if( devLine == IL_TERMINAL ) {
if( !subdevice ) {
devreg->term.transm_command = command;
}
else {
devreg->term.recv_command = command;
}
if( !b_error && *semKey >= 0 && !(b_error = semaphore_P( semKey, pid ) ) ) {
if( devLine == IL_TERMINAL ) {
if( !subdevice ) {
devreg->term.transm_command = command;
}
else {
devreg->dtp.command = command;
devreg->term.recv_command = command;
}
}
else {
devreg->dtp.command = command;
}
}
return b_error;
}
Expand Down
2 changes: 1 addition & 1 deletion src/scheduler/scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ int scheduler_RemoveProgeny( pcb_t* p ) {
* e poi elimina il padre appena elaborato dallo stack per deallocarlo
*/

if( !scheduler_RemoveProcessFromAnyQ( parent ) ){
if( scheduler_RemoveProcessFromAnyQ( parent ) ){
return -1;
}
list_add( &p->p_next, &pcb_stack );
Expand Down
1 change: 1 addition & 0 deletions src/utilities/semaphore.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ int semaphore_P( int *semkey, pcb_t * p ) {
int b_error = 0;
if( --(*semkey) < 0 ) {
b_error = scheduler_StateToWaiting( p, semkey );
if( b_error ) ++(*semkey);
}
return b_error;
}
Expand Down

0 comments on commit f58378c

Please sign in to comment.