Dan Hipschman <[EMAIL PROTECTED]> writes:

> @@ -129,6 +131,21 @@ ServiceMain(DWORD dwArgc, LPWSTR *lpszArgv)
>          return;
>      }
>  
> +    globalMgr.jobEvent = CreateEventW(NULL, TRUE, FALSE, NULL);
> +    if (!globalMgr.jobEvent) {
> +        ERR("Couldn't create event: error %d\n", GetLastError());
> +        UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
> +        return;
> +    }
> +
> +    fileTxThread = CreateThread(NULL, 0, fileTransfer, NULL, 0, &threadId);
> +    if (!fileTxThread)
> +    {
> +        ERR("Failed starting file transfer thread\n");
> +        UpdateStatus(SERVICE_STOPPED, NO_ERROR, 0);
> +        return;
> +    }
> +
>      UpdateStatus(SERVICE_RUNNING, NO_ERROR, 0);

You also need to shutdown the thread properly when the service
terminates.

-- 
Alexandre Julliard
[EMAIL PROTECTED]


Reply via email to