排队功能,使它们同步触发

时间:2019-01-16 15:17:08

标签: c# synchronization queueing

我有一个使用适当的DLL控制某些步进电机的应用程序。我发现有时会出现错误,好像我用来与控制器通信的功能触发得太近了,并没有时间让控制器响应。

private void CommandZ(string command)
{
    DMX_UMD_API.Flush(hUSBDevice_Z);

    string tmpString = "";
    bool status;
    status = DMX_UMD_API.performaxSendAndGetReply_Z(hUSBDevice_Z, command, out tmpString);
}

public string loopCommands_Z(string command)
{
    DMX_UMD_API.Flush(hUSBDevice_Z);
    string tmpString = "";
    bool status;
    status = DMX_UMD_API.performaxSendAndGetReply_Z(hUSBDevice_Z, command, out tmpString);
    if (status)
    {
        return tmpString;
    }
    else
    {
        return "";
    }
}

如何将功能排队,以便它们同步发生?

0 个答案:

没有答案
相关问题