|
7 | 7 | *
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.44 1998/12/18 19:45:37 momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.45 1998/12/29 18:29:18 momjian Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
|
46 | 46 | *This is so that we can support more backends. (system-wide semaphore
|
47 | 47 | *sets run out pretty fast.) -ay 4/95
|
48 | 48 | *
|
49 |
| - * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.44 1998/12/18 19:45:37 momjian Exp $ |
| 49 | + * $Header: /cvsroot/pgsql/src/backend/storage/lmgr/proc.c,v 1.45 1998/12/29 18:29:18 momjian Exp $ |
50 | 50 | */
|
51 | 51 | #include<sys/time.h>
|
52 | 52 | #include<unistd.h>
|
@@ -449,7 +449,6 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
|
449 | 449 | inti;
|
450 | 450 | booldeadlock_checked= false;
|
451 | 451 | PROC*proc;
|
452 |
| -structtimevaltimeval; |
453 | 452 |
|
454 | 453 | /*
|
455 | 454 | * If the first entries in the waitQueue have a greater priority than
|
@@ -513,29 +512,24 @@ ProcSleep(PROC_QUEUE *waitQueue,/* lock->waitProcs */
|
513 | 512 | SpinRelease(spinlock);
|
514 | 513 |
|
515 | 514 | /* --------------
|
516 |
| - * We set this so we can wake upperiodically and check for a deadlock. |
| 515 | + * We set this so we can wake upafter one second to check for a deadlock. |
517 | 516 | * If a deadlock is detected, the handler releases the processes
|
518 | 517 | * semaphore and aborts the current transaction.
|
519 |
| - * |
520 |
| - * Need to zero out struct to set the interval and the micro seconds fields |
521 |
| - * to 0. |
522 | 518 | * --------------
|
523 | 519 | */
|
524 |
| -MemSet(&timeval,0,sizeof(structtimeval)); |
525 |
| -timeval.tv_sec= \ |
526 |
| -(DeadlockCheckTimer ?DeadlockCheckTimer :DEADLOCK_CHECK_TIMER); |
527 | 520 |
|
528 | 521 | do
|
529 | 522 | {
|
530 |
| -intexpire; |
| 523 | +intexpired; |
531 | 524 |
|
532 | 525 | MyProc->errType=NO_ERROR;/* reset flag after deadlock check */
|
533 | 526 |
|
534 |
| -if ((expire=select(0,NULL,NULL,NULL, |
535 |
| -(deadlock_checked== false) ?&timeval :NULL))==-1) |
536 |
| -elog(FATAL,"ProcSleep: Unable to set timer for process wakeup"); |
| 527 | +if (deadlock_checked== false) |
| 528 | +expired=sleep(DeadlockCheckTimer ?DeadlockCheckTimer :DEADLOCK_CHECK_TIMER); |
| 529 | +else |
| 530 | +pause(); |
537 | 531 |
|
538 |
| -if (expire==0/* timeout reached */&&deadlock_checked== false) |
| 532 | +if (expired==0&&deadlock_checked== false) |
539 | 533 | {
|
540 | 534 | HandleDeadLock();
|
541 | 535 | deadlock_checked= true;
|
|