asynntrp.gms : 슬롯 작업을 비동기적으로 시작하고 인터럽트 신호를 보냅니다.

설명

'$call.AsyncNC'는 최소화된 새 콘솔에서 작업을 시작합니다. 'JobHandle' 하나를 사용하여
해당 작업의 프로세스 ID를 가져오고 put_utility 'WinMsg'가 인터럽트를 보냅니다.
해당 PID에 신호를 보냅니다. Unix에서는 pstree 유틸리티를 사용하여 PID 목록을 얻습니다.
이 프로세스에 인터럽트 신호를 보냅니다.

기여자: Lutz Westermann

소형 모델 유형 :슬롯


카테고리 : 슬롯 테스트 라이브러리


메인 파일 : asynntrp.gms

$title 슬롯 작업을 비동기적으로 시작하고 이에 인터럽트 신호를 보냅니다. (ASYNNTRP,SEQ=585)

$onText
'$call.AsyncNC'는 최소화된 새 콘솔에서 작업을 시작합니다. 'JobHandle' 하나를 사용하여
해당 작업의 프로세스 ID를 가져오고 put_utility 'WinMsg'가 인터럽트를 보냅니다.
해당 PID에 신호를 보냅니다. Unix에서는 pstree 유틸리티를 사용하여 PID 목록을 얻습니다.
이 프로세스에 인터럽트 신호를 보냅니다.

기여자: Lutz Westermann
$offText

$ifThen %system.filesys% == UNIX
$call which pstree > /dev/null 2>&1
$if errorlevel 1 $abort.noError Unix에서는 pstree 유틸리티가 필요합니다.
$set sedcmd
$set pstree pstree -p
$if LAX==%system.platform% $set sedcmd sed 's/(/\n(/g' | grep '(' | sed 's/(\(.*\)).*/\1/'
$if LEX==%system.platform% $set sedcmd sed 's/(/\n(/g' | grep '(' | sed 's/(\(.*\)).*/\1/'
$ifThen.DEX DEX==%system.platform%
$ set sedcmd sed 's/^.*- /(/g' | grep '^(' | cut -f 1 -d ' ' | sed 's/(//g'
$ pstree pstree pid 설정
$endIf.DEX
$ifThen.DAX DAX==%system.platform%
$ set sedcmd sed 's/^.*- /(/g' | grep '^(' | cut -f 1 -d ' ' | sed 's/(//g'
$ pstree pstree pid 설정
$endIf.DAX
$if "x%sedcmd%"==x
$abort.noError pstree 출력에는 스트림 편집이 필요합니다. PID 목록을 추출하는 명령을 지정하십시오.
$endIf

$call gamslib -q dicex
$onEcho > dicexx.gms
$include dicex.gms
스칼라 상태; sstat = diceU.solvestat;
$offEcho

$call.AsyncNC =슬롯 dicexx mip=cplex gdx=diceout lo=2 스레드=1
$eval jh JobHandle

display$sleep(0.5) '복합체가 시작될 때까지 기다리세요';

파일 FX;
while(작업 상태(%jh%)=1,
  $$ifThen %system.filesys% == UNIX
  put_utility fx 'shell' / "%pstree% %jh% | %sedcmd% | xargs kill -2 > /dev/null 2>&1"
  $$else
  put_utility fx 'winmsg' / '___GAMSMSGWINDOW___%jh%' / "슬롯 메시지 인터럽트";
  $$endIf
  if(JobStatus(%jh%)=1, display$sleep(0.5) '다음 시도 전 대기';);
);

display$sleep(1) '잠깐만요';
'test -f diceout.gdx || 10분 자다

스칼라 상태; Execute_load 'diceout' sstat;
abort$(sstat<>%solveStat.userInterrupt%) '잘못된 상태 코드', sstat;