C言語なら俺に聞け( ..
183:183
07/05/11 20:29:09
↓のソースで、☆印の行は何か意味があるでしょうか。
あってもなくても変わらない気がするのですが...
( 環境:Windows Vista , Visual Studio C++ Express Edition )
#include <stdio.h>
#include <windows.h>
#define THREAD_NUM 4
#define DATA_NUM 12
typedef struct _thread_type {
int thread_no;
int *data;
CRITICAL_SECTION *cs;
} thread_arg_t;
void thread_func(void *arg) {
thread_arg_t* targ = (thread_arg_t *)arg;
int i, result;
for (i = 0; i < DATA_NUM; i++) {
// EnterCriticalSection(targ->cs);
result = targ->data[i] + 1;
Sleep(0); ☆
targ->data[i] = result;
// LeaveCriticalSection(targ->cs);
}
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
5244日前に更新/240 KB
担当:undef