- 183 名前:183 mailto:sage [2007/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); } }
|

|