blob: baad3e8001a037ae2f4aba81388eda25aaf180c9 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
This test shows coordinating between 2 threads using
mutexes with wait/notify. Numbers between threads
should increment together.
-->
<jelly xmlns="jelly:core" xmlns:threads="jelly:threads">
<threads:thread var="thread1">
<whitespace>
thread1: going to sleep for 2 seconds
</whitespace>
<threads:sleep for="2000"/>
</threads:thread>
<threads:thread var="thread2">
<threads:waitfor thread="${thread1}"/>
<whitespace>
thread2: finished waiting for thread1, sleeping for 2 seconds
</whitespace>
<threads:sleep for="1000"/>
</threads:thread>
<threads:thread>
<threads:waitfor thread="${thread1}"/>
<whitespace>
thread3: finished waiting for thread1
</whitespace>
</threads:thread>
<threads:thread>
<threads:waitfor thread="${thread2}"/>
<whitespace>
thread4: finished waiting for thread2
</whitespace>
</threads:thread>
</jelly>