我正在设计两个线程:一个必须获取播放器的名称,第二个线程必须等待设置的名称才能继续,但第一个线程中的notify()all抛出了IllegalMonitorStateException错误.
private NameFecth nameFetch;
private UseName useName;
private Object nameSetLock;
public static void method{
nameSetLock = new Object()
nameFetch = new NameFetch(nameSetLock);
useName = new UseName(nameSetLock);
Thread nameFetchThread = new Thread(nameFetch);
nameFetchThread.start();
Thread useNameThread = new Thread(useName);
useNameThread.start();
}
public class NameFetch implements Runnable{
/*variables and constructers*/
public void run(){
/*get name and set the variable somehow*/
synchronized(nameSetLock){
notifyAll();
}
}
}
public class UseName implements Runnable{
/*variables and constructers*/
public void run(){
while(!nameBeenSet){
synchronized(nameSetLock){
try{
wait();
}catch(InterruptedException e) {} …Run Code Online (Sandbox Code Playgroud) #include <stdio.h>
int main(int argc, const char * argv[])
{
long nc;
nc=0;
while (getchar()!=EOF) {
++nc;
printf("%ld\n", nc);
}
}
Run Code Online (Sandbox Code Playgroud)
这是代码,当我输入一个字符时,它将打印1然后打印2,即使我只键入一次.
我正在使用Xcode.
我正在使用 yagarto 的 arm-none-eabi 来编译汇编代码,但它给出了消息
Error: bad instruction `a DCD 1,2,3'
Run Code Online (Sandbox Code Playgroud)
当我使用 DCD 指令时
使用不合法吗?如果没有,我如何为 ARM 中的数据保留内存空间?
谢谢