Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / C++ [игнор отключен] [закрыт для гостей] / Threads - пример / 2 сообщений из 2, страница 1 из 1
19.02.2007, 11:19
    #34340295
dimadv
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Threads - пример
Пытаюсь запустить такой пример
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
unsigned int WINAPI Testing(void *_hEvent)
{
    // ждем, события от главной нити
    WaitForSingleObject(_hEvent, INFINITE);

    // выполняем какие то действия
    cout << "Testing" << endl;

    return  0  ;
}

    HANDLE hEvent;
    // создаем объект "событие со сбросом вручную" (в занятом состоянии)
    hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

    // Создаем нить
    HANDLE hThread;
    unsigned int dwThreadID;

    hThread = (HANDLE)_beginthreadex(NULL,  0 , Testing, NULL, (void *)&hEvent, &dwThreadID);

Компилятор выдает следующее:
'_beginthreadex' : cannot convert parameter 5 from 'void *' to 'unsigned int'
Как поправить подскажите пожалуйста
...
Рейтинг: 0 / 0
19.02.2007, 11:50
    #34340411
Akh
Akh
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Threads - пример
автор
Creates a thread.


uintptr_t _beginthread(
void( *start_address )( void * ),
unsigned stack_size,
void *arglist
);
uintptr_t _beginthreadex(
void *security,
unsigned stack_size,
unsigned ( *start_address )( void * ),
void *arglist,
unsigned initflag,
unsigned *thrdaddr
);



Parameters
start_address
Start address of a routine that begins execution of a new thread. For _beginthread, the calling convention is either __cdecl or __clrcall; for _beginthreadex, it is either __stdcall or __clrcall.

stack_size
Stack size for a new thread or 0.

arglist
Argument list to be passed to a new thread or NULL.

security
Pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle can be inherited by child processes. If NULL, the handle cannot be inherited. Must be NULL for Windows 95 applications.

initflag
Initial state of a new thread (0 for running or CREATE_SUSPENDED for suspended); use ResumeThread to execute the thread.


thrdaddr
Points to a 32-bit variable that receives the thread identifier. Might be NULL, in which case it is not used.

....
...
Рейтинг: 0 / 0
Форумы / C++ [игнор отключен] [закрыт для гостей] / Threads - пример / 2 сообщений из 2, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]