| | |
| | | <CharacterSet>Unicode</CharacterSet> |
| | | </PropertyGroup> |
| | | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
| | | <ConfigurationType>Application</ConfigurationType> |
| | | <ConfigurationType>StaticLibrary</ConfigurationType> |
| | | <UseDebugLibraries>true</UseDebugLibraries> |
| | | <PlatformToolset>v142</PlatformToolset> |
| | | <CharacterSet>Unicode</CharacterSet> |
| | |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="TradeSuccessCapture.cpp" /> |
| | | <ClCompile Include="CaptureUtil.cpp" /> |
| | | <ClCompile Include="IndustryCapture.cpp" /> |
| | | <ClCompile Include="LimitUpCapture.cpp" /> |
| | |
| | | <ClCompile Include="win32_screen_shots.cpp" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="TradeSuccessCapture.h" /> |
| | | <ClInclude Include="CaptureUtil.h" /> |
| | | <ClInclude Include="error.h" /> |
| | | <ClInclude Include="ImgDivider.h" /> |
| | |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="kernel.cl" /> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| | | <ImportGroup Label="ExtensionTargets"> |
| | | <Import Project="..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets" Condition="Exists('..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets')" /> |
| | | <Import Project="..\packages\pthreads.2.9.1.4\build\native\pthreads.targets" Condition="Exists('..\packages\pthreads.2.9.1.4\build\native\pthreads.targets')" /> |
| | | </ImportGroup> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | | <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> |
| | | </PropertyGroup> |
| | | <Error Condition="!Exists('..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets'))" /> |
| | | <Error Condition="!Exists('..\packages\pthreads.2.9.1.4\build\native\pthreads.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\pthreads.2.9.1.4\build\native\pthreads.targets'))" /> |
| | | </Target> |
| | | </Project> |
| | |
| | | <ClCompile Include="IndustryCapture.cpp"> |
| | | <Filter>源文件</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="TradeSuccessCapture.cpp"> |
| | | <Filter>源文件</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="resource.h"> |
| | |
| | | <ClInclude Include="IndustryCapture.h"> |
| | | <Filter>头文件</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="TradeSuccessCapture.h"> |
| | | <Filter>头文件</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ResourceCompile Include="ConsoleApplication.rc"> |
| | |
| | | <None Include="kernel.cl"> |
| | | <Filter>源文件</Filter> |
| | | </None> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | </Project> |
| | |
| | | #include "IndustryCapture.h" |
| | | #include "THSActionUtil.h" |
| | | #include <set> |
| | | #include "Win32Util.h" |
| | | OpenCLExcuter* IndustryCapture::openCLExcuter; |
| | |
| | | |
| | | HWND IndustryCapture::win; |
| | | |
| | | CallbackFun_Industry IndustryCapture::data_callback; |
| | | void* IndustryCapture::context; |
| | | |
| | | bool IndustryCapture::terminated; |
| | | |
| | | |
| | | RecognitionManager* IndustryCapture::recognitionManager; |
| | |
| | | |
| | | |
| | | |
| | | void IndustryCapture::init() { |
| | | void IndustryCapture::init(CallbackFun_Industry callback, void* contex) { |
| | | terminated = false; |
| | | data_callback = callback; |
| | | context = contex; |
| | | recognitionManager = new RecognitionManager(); |
| | | openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | refreshHWND(); |
| | | try { |
| | | refreshHWND(); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | } |
| | | void IndustryCapture::refreshHWND() { |
| | | HWND hwnd = THSActionUtil::getIndustryWindow(); |
| | |
| | | |
| | | |
| | | list<list<IndustryData>> IndustryCapture::captureIndustryCodes(cv::Mat oimg) { |
| | | cv::Mat grayImg_ = cv::Mat::zeros(oimg.rows, oimg.cols, CV_8UC1);//ImgUtil::grayImage(oimg); |
| | | |
| | | uchar* imgData = (uchar*)malloc(sizeof(uchar) * oimg.rows * oimg.cols); |
| | | if (oimg.channels() == 3) |
| | | { |
| | | openCLExcuter->rgb2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | else { |
| | | openCLExcuter->rgba2Gray(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | grayImg_.data = imgData; |
| | | //cv::imwrite("C:\\Users\\Administrator\\Desktop\\ocr\\industry.jpg", grayImg); |
| | | cv::Mat grayImg_ = grayImgs(oimg); |
| | | |
| | | GPCodeArea menu = THSActionUtil::splitPlateMenuArea(grayImg_); |
| | | list<int*> menus = splitMenu(menu, grayImg_); |
| | | |
| | | free(grayImg_.data); |
| | | grayImg_.release(); |
| | | |
| | | list<list<IndustryData>> flist; |
| | | |
| | | int menu_index = 0; |
| | | |
| | | for (list<int*>::iterator ele = menus.begin();ele != menus.end();ele++) { |
| | | menu_index++; |
| | | |
| | | int x = ((*ele)[0] + (*ele)[2]) / 2; |
| | | int y = ((*ele)[1] + (*ele)[3]) / 2; |
| | | //点击 |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(x, y)); |
| | | if (menu_index > 1) |
| | | { |
| | | //点击 |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(x, y)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(x, y)); |
| | | } |
| | | |
| | | list<IndustryData> dataList; |
| | | for (int i = 0;i < 3;i++) { |
| | | |
| | | for (int i = 0;i < 10;i++) { |
| | | if (terminated) { |
| | | break; |
| | | } |
| | | Sleep(500); |
| | | //截图+灰度化 |
| | | |
| | | list<IndustryData> itemList; |
| | | |
| | | cv::Mat grayImg = grayImgs(CaptureUtil::capture(win)); |
| | | list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg); |
| | | try { |
| | | |
| | | //每行的元素个数 |
| | | int ele_count_per_line = 2; |
| | | int* splitResult = (int*)malloc(sizeof(int) * 4 * ele_count_per_line * rowData.size()); |
| | | int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | int count = 0; |
| | | for (std::list<int*>::iterator ele = rowData.begin();ele != rowData.end();ele++) { |
| | | cv::Mat grayImg = grayImgs(CaptureUtil::capture(win)); |
| | | list<int*> rowData = THSActionUtil::splitPlateRowArea(grayImg); |
| | | |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(count)).append(".jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg, cv::Rect((*ele)[0], (*ele)[1], (*ele)[2] - (*ele)[0] + 1, (*ele)[3] - (*ele)[1] + 1))); |
| | | rowIndex[4 * count + 0] = (*ele)[0]; |
| | | rowIndex[4 * count + 1] = (*ele)[1]; |
| | | rowIndex[4 * count + 2] = (*ele)[2]; |
| | | rowIndex[4 * count + 3] = (*ele)[3]; |
| | | free(*ele); |
| | | count++; |
| | | } |
| | | //每行的元素个数 |
| | | int ele_count_per_line = 2; |
| | | int* splitResult = (int*)malloc(sizeof(int) * 4 * ele_count_per_line * rowData.size()); |
| | | int* rowIndex = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | int count = 0; |
| | | for (std::list<int*>::iterator ele = rowData.begin();ele != rowData.end();ele++) { |
| | | |
| | | int line_number_count = ele_count_per_line * 6; |
| | | |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line, 1, 2, splitResult); |
| | | |
| | | //分割数字 |
| | | unsigned char* zeroData = (unsigned char*)malloc(sizeof(unsigned char) * _NUMBER_GP_CODE_WIDTH * _NUMBER_GP_CODE_HEIGHT); |
| | | for (int r = 0;r < _NUMBER_GP_CODE_HEIGHT;r++) { |
| | | for (int c = 0;c < _NUMBER_GP_CODE_WIDTH;c++) |
| | | { |
| | | zeroData[r * _NUMBER_GP_CODE_WIDTH + c] = ImgUtil::NUMS_GP_CODE[0].data.ptr<uchar>(r)[c]; |
| | | } |
| | | } |
| | | unsigned char* totalNumberData = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | |
| | | UcharDataInfo typesData = UcharDataInfo(); |
| | | unsigned char types[] = { NUM_TYPE_CODE,NUM_TYPE_MONEY}; |
| | | typesData.length = 2; |
| | | typesData.data = types; |
| | | |
| | | openCLExcuter->splitPlateNum(grayImg, IntDataInfo({ splitResult,(int) (ele_count_per_line * rowData.size()) }), UcharDataInfo({ totalNumberData, -1 }), typesData, zeroData, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, ele_count_per_line, 6); |
| | | |
| | | |
| | | |
| | | |
| | | //识别数字 |
| | | uchar* templateNums = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | openCLExcuter->createNumberTemplates(rowData.size(), _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count, ImgUtil::numsOneLevel_gpcode, templateNums); |
| | | uchar** numberResult = openCLExcuter->recognition_numbers(totalNumberData, templateNums, rowData.size() * _NUMBER_GP_CODE_HEIGHT, _NUMBER_GP_CODE_WIDTH * 10 * line_number_count, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count); |
| | | |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | IndustryData industryData = IndustryData(); |
| | | string code = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][6*1+j])); |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(count)).append(".jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg, cv::Rect((*ele)[0], (*ele)[1], (*ele)[2] - (*ele)[0] + 1, (*ele)[3] - (*ele)[1] + 1))); |
| | | rowIndex[4 * count + 0] = (*ele)[0]; |
| | | rowIndex[4 * count + 1] = (*ele)[1]; |
| | | rowIndex[4 * count + 2] = (*ele)[2]; |
| | | rowIndex[4 * count + 3] = (*ele)[3]; |
| | | free(*ele); |
| | | count++; |
| | | } |
| | | |
| | | string money = ""; |
| | | for (int j = 0;j < 6;j++) |
| | | { |
| | | if (j == 4) { |
| | | money.append("."); |
| | | int length_per_num = 6; |
| | | |
| | | int line_number_count = ele_count_per_line * length_per_num; |
| | | |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line, 1, 2, splitResult); |
| | | |
| | | //分割数字 |
| | | unsigned char* zeroData = (unsigned char*)malloc(sizeof(unsigned char) * _NUMBER_GP_CODE_WIDTH * _NUMBER_GP_CODE_HEIGHT); |
| | | for (int r = 0;r < _NUMBER_GP_CODE_HEIGHT;r++) { |
| | | for (int c = 0;c < _NUMBER_GP_CODE_WIDTH;c++) |
| | | { |
| | | zeroData[r * _NUMBER_GP_CODE_WIDTH + c] = ImgUtil::NUMS_GP_CODE[0].data.ptr<uchar>(r)[c]; |
| | | } |
| | | money.append(to_string(numberResult[i][ j])); |
| | | } |
| | | unsigned char* totalNumberData = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | |
| | | industryData.index = i; |
| | | industryData.code = code; |
| | | industryData.zyltMoney = money; |
| | | itemList.push_back(industryData); |
| | | free(numberResult[i]); |
| | | } |
| | | free(numberResult); |
| | | int* unitData = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | UcharDataInfo typesData = UcharDataInfo(); |
| | | unsigned char types[] = { NUM_TYPE_MONEY,NUM_TYPE_CODE }; |
| | | typesData.length = 2; |
| | | typesData.data = types; |
| | | |
| | | openCLExcuter->splitPlateNum(grayImg, IntDataInfo({ splitResult,(int)(ele_count_per_line * rowData.size()) }), UcharDataInfo({ totalNumberData, -1 }), typesData, zeroData, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, ele_count_per_line, length_per_num); |
| | | |
| | | |
| | | |
| | | //识别金额单位 |
| | | int index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | unitData[index * 4 + 0] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 0]; |
| | | unitData[index * 4 + 1] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 1]; |
| | | unitData[index * 4 + 2] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 2]; |
| | | unitData[index * 4 + 3] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 3]; |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(index)).append("_1.jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg,cv::Rect(unitData[index * 4 + 0], unitData[index * 4 + 1], unitData[index * 4 + 2]- unitData[index * 4 + 0]+1, unitData[index * 4 + 3]- unitData[index * 4 + 1]+1))); |
| | | |
| | | index++; |
| | | } |
| | | int* unitResult = (int*)malloc(sizeof(int) * itemList.size()); |
| | | openCLExcuter->recognitionPlateMoneyUnit(grayImg.data, grayImg.cols, grayImg.rows, unitData, 1, itemList.size(), unitResult); |
| | | index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | switch (unitResult[index]) |
| | | { |
| | | case 0: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_Y; |
| | | break; |
| | | case 1: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_W; |
| | | break; |
| | | default: |
| | | break; |
| | | //识别数字 |
| | | uchar* templateNums = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_GP_CODE_HEIGHT * rowData.size()) * _NUMBER_GP_CODE_WIDTH * 10 * line_number_count); |
| | | openCLExcuter->createNumberTemplates(rowData.size(), _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count, ImgUtil::numsOneLevel_gpcode, templateNums); |
| | | uchar** numberResult = openCLExcuter->recognition_numbers(totalNumberData, templateNums, rowData.size() * _NUMBER_GP_CODE_HEIGHT, _NUMBER_GP_CODE_WIDTH * 10 * line_number_count, _NUMBER_GP_CODE_WIDTH, _NUMBER_GP_CODE_HEIGHT, line_number_count); |
| | | |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | IndustryData industryData = IndustryData(); |
| | | string code = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][6 * 1 + j])); |
| | | } |
| | | |
| | | string money = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | if (j == 4) { |
| | | money.append("."); |
| | | } |
| | | money.append(to_string(numberResult[i][j])); |
| | | } |
| | | |
| | | industryData.index = i; |
| | | industryData.code = code; |
| | | industryData.zyltMoney = money; |
| | | itemList.push_back(industryData); |
| | | free(numberResult[i]); |
| | | } |
| | | index++; |
| | | free(numberResult); |
| | | int* unitData = (int*)malloc(sizeof(int) * 4 * rowData.size()); |
| | | |
| | | |
| | | |
| | | //识别金额单位 |
| | | int index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | unitData[index * 4 + 0] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 0]; |
| | | unitData[index * 4 + 1] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 1]; |
| | | unitData[index * 4 + 2] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 2]; |
| | | unitData[index * 4 + 3] = splitResult[(*ele).index * 4 * ele_count_per_line + 4 * 0 + 3]; |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\limit_up\\"; |
| | | path.append(to_string(index)).append("_1.jpg"); |
| | | //cv::imwrite(path, cv::Mat(grayImg,cv::Rect(unitData[index * 4 + 0], unitData[index * 4 + 1], unitData[index * 4 + 2]- unitData[index * 4 + 0]+1, unitData[index * 4 + 3]- unitData[index * 4 + 1]+1))); |
| | | |
| | | index++; |
| | | } |
| | | int* unitResult = (int*)malloc(sizeof(int) * itemList.size()); |
| | | openCLExcuter->recognitionPlateMoneyUnit(grayImg.data, grayImg.cols, grayImg.rows, unitData, 1, itemList.size(), unitResult); |
| | | index = 0; |
| | | for (list<IndustryData>::iterator ele = itemList.begin();ele != itemList.end();ele++) { |
| | | switch (unitResult[index]) |
| | | { |
| | | case 0: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_Y; |
| | | break; |
| | | case 1: |
| | | (*ele).zyltMoneyUnit = MONEY_UNIT_W; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | index++; |
| | | } |
| | | |
| | | free(rowIndex); |
| | | free(splitResult); |
| | | free(zeroData); |
| | | free(totalNumberData); |
| | | free(templateNums); |
| | | free(unitData); |
| | | free(unitResult); |
| | | free(grayImg.data); |
| | | grayImg.release(); |
| | | |
| | | |
| | | for (list<IndustryData>::iterator el = itemList.begin();el != itemList.end();el++) { |
| | | dataList.push_back(*el); |
| | | } |
| | | } |
| | | free(rowIndex); |
| | | free(splitResult); |
| | | free(zeroData); |
| | | free(templateNums); |
| | | free(unitData); |
| | | free(unitResult); |
| | | free(grayImg.data); |
| | | grayImg.release(); |
| | | |
| | | |
| | | for (list<IndustryData>::iterator el = itemList.begin();el != itemList.end();el++) { |
| | | dataList.push_back(*el); |
| | | catch (...) { |
| | | |
| | | } |
| | | |
| | | int x = oimg.cols - 50; |
| | |
| | | Sleep(10); |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKELONG(x, y)); |
| | | } |
| | | |
| | | data_callback(dataList, context); |
| | | flist.push_back(dataList); |
| | | //break; |
| | | if (terminated) { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return flist; |
| | |
| | | list<list<IndustryData>> IndustryCapture::captureIndustryCodes() { |
| | | list<list<IndustryData>> flist; |
| | | set<string> codesSet; |
| | | //测试 |
| | | for (int i = 0;i < 3;i++) { |
| | | Sleep(1000); |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | |
| | | for (list<list<IndustryData>>::iterator el = codes.begin();el != codes.end();el++) { |
| | | flist.push_back(*el); |
| | | } |
| | | if (terminated) { |
| | | break; |
| | | } |
| | | //滑动到下一页 |
| | | RECT rect; |
| | | GetWindowRect(win, &rect); |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(20, 100)); |
| | | SendMessage(win, WM_LBUTTONDOWN, 0, MAKELONG(50, 100)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(20, 100)); |
| | | SendMessage(win, WM_LBUTTONUP, 0, MAKELONG(50, 100)); |
| | | Sleep(10); |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(20, 100)); |
| | | SendMessage(win, WM_MOUSEWHEEL, 0, MAKEWORD(50, 100)); |
| | | } |
| | | terminated = false; |
| | | return flist; |
| | | } |
| | | |
| | | bool IndustryCapture::isInited() { |
| | | return inited; |
| | | } |
| | | } |
| | | |
| | | void IndustryCapture::stop() { |
| | | terminated = true; |
| | | } |
| | |
| | | }; |
| | | |
| | | |
| | | typedef void (*CallbackFun_Industry)(list<IndustryData> dataList, void* contex); |
| | | |
| | | class IndustryCapture |
| | | { |
| | | private: |
| | |
| | | static bool inited; |
| | | |
| | | static HWND win; |
| | | static CallbackFun_Industry data_callback; |
| | | static void* context; |
| | | |
| | | static cv::Mat grayImgs(cv::Mat img); |
| | | |
| | | static bool terminated; |
| | | |
| | | |
| | | public: |
| | | void init(); |
| | | void init(CallbackFun_Industry callback, void* context); |
| | | void refreshHWND(); |
| | | |
| | | static list<list<IndustryData>> captureIndustryCodes(cv::Mat img); |
| | |
| | | static list<list<IndustryData>> captureIndustryCodes(); |
| | | |
| | | bool isInited(); |
| | | |
| | | void stop(); |
| | | }; |
| | | |
| | |
| | | std::cout << " 耗时:" << (clock() - time_0) << std::endl; |
| | | } |
| | | |
| | | void OpenCLExcuter::splitL2NumNew(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num) { |
| | | |
| | | |
| | | clock_t time_0 = clock(); |
| | | |
| | | kernel = clCreateKernel(program, "split_l2_num_new", &error); |
| | | if (kernel == NULL) { |
| | | throw("Couldn't create kernel!\n"); |
| | | } |
| | | |
| | | int inputSize = (img.cols * img.rows); |
| | | |
| | | int resultSize = pos.length * (length_per_num * 10 * num_width * num_height); |
| | | |
| | | |
| | | //创建缓存对象 |
| | | |
| | | cl_mem memObject1 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, sizeof(unsigned char) * inputSize, img.data, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject1 failed!\n"); |
| | | } |
| | | |
| | | cl_mem memObject2 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, |
| | | sizeof(int) * pos.length * 4, pos.data, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject2 failed!\n"); |
| | | } |
| | | |
| | | cl_mem memObject3 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, |
| | | sizeof(unsigned char) * num_width * num_height, zero, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject3 failed!\n"); |
| | | } |
| | | |
| | | cl_mem memObject4 = clCreateBuffer(context, CL_MEM_WRITE_ONLY, |
| | | sizeof(unsigned char) * resultSize, NULL, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject4 failed!\n"); |
| | | } |
| | | |
| | | |
| | | |
| | | cl_mem memObject5 = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, |
| | | sizeof(unsigned char) * types.length, types.data, &error); |
| | | if (error < 0) { |
| | | throw("Creat memObject5 failed!\n"); |
| | | } |
| | | |
| | | //设置内核参数 |
| | | error = clSetKernelArg(kernel, 0, sizeof(cl_mem), &memObject1); |
| | | error |= clSetKernelArg(kernel, 1, sizeof(cl_mem), &memObject2); |
| | | error |= clSetKernelArg(kernel, 2, sizeof(cl_mem), &memObject3); |
| | | error |= clSetKernelArg(kernel, 3, sizeof(cl_mem), &memObject5); |
| | | error |= clSetKernelArg(kernel, 4, sizeof(int), &img.cols); |
| | | error |= clSetKernelArg(kernel, 5, sizeof(int), &num_width); |
| | | error |= clSetKernelArg(kernel, 6, sizeof(int), &num_height); |
| | | error |= clSetKernelArg(kernel, 7, sizeof(int), &ele_count_per_line); |
| | | error |= clSetKernelArg(kernel, 8, sizeof(int), &length_per_num); |
| | | error |= clSetKernelArg(kernel, 9, sizeof(cl_mem), &memObject4); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error setting kernel arguments!\n"); |
| | | } |
| | | //执行内核 |
| | | size_t globalWorkSize[1] = { pos.length }; |
| | | size_t localWorkSize[1] = { 1 }; |
| | | |
| | | const int work_dim = 1; |
| | | |
| | | error = clEnqueueNDRangeKernel(queue, kernel, work_dim, NULL, globalWorkSize, |
| | | localWorkSize, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error queuing kernel for execution!\n"); |
| | | } |
| | | |
| | | //读取执行结果 |
| | | error = clEnqueueReadBuffer(queue, memObject4, CL_TRUE, 0, resultSize * sizeof(unsigned char), |
| | | result.data, 0, NULL, NULL); |
| | | if (error != CL_SUCCESS) { |
| | | throw("Error reading result buffer!\n"); |
| | | } |
| | | |
| | | |
| | | |
| | | clReleaseKernel(kernel); |
| | | clReleaseMemObject(memObject1); |
| | | clReleaseMemObject(memObject2); |
| | | clReleaseMemObject(memObject3); |
| | | clReleaseMemObject(memObject4); |
| | | clReleaseMemObject(memObject5); |
| | | std::cout << " 耗时:" << (clock() - time_0) << std::endl; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | void OpenCLExcuter::rgb2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | void OpenCLExcuter::rgb2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result) { |
| | | |
| | | kernel = clCreateKernel(program, "rgb2GrayImgInvert", &error); |
| | | kernel = clCreateKernel(program, "rgb2ThresholdInvert", &error); |
| | | if (kernel == NULL) { |
| | | throw("Couldn't create kernel!\n"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | void OpenCLExcuter::rgba2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | void OpenCLExcuter::rgba2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result) { |
| | | |
| | | kernel = clCreateKernel(program, "rgba2GrayImgInvert", &error); |
| | | kernel = clCreateKernel(program, "rgba2ThresholdInvert", &error); |
| | | if (kernel == NULL) { |
| | | throw("Couldn't create kernel!\n"); |
| | | } |
| | |
| | | unsigned char* result); |
| | | |
| | | |
| | | void rgb2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | void rgb2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result); |
| | | |
| | | void rgba2GrayInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | void rgba2ThresholdInvert(unsigned char* imgs, int imgWidth, int imgHeight, |
| | | unsigned char* result); |
| | | |
| | | |
| | |
| | | //分隔板块数字,通用 |
| | | void splitPlateNum(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num); |
| | | |
| | | |
| | | void splitL2NumNew(cv::Mat img, IntDataInfo pos, UcharDataInfo result, UcharDataInfo types, unsigned char* zero, int num_width, int num_height, int ele_count_per_line, int length_per_num); |
| | | |
| | | |
| | | |
| | | //分隔板块数字 |
| | | void splitPlateNum(unsigned char* img, int img_width, int img_height, int* pos, int pos_count, unsigned char* zero, int num_width, int num_height, int number_count, unsigned char* result); |
| | | |
| | |
| | | } |
| | | |
| | | HWND THSActionUtil::getTradeWindow() { |
| | | list<HWND> wlist = Win32Util::searchWindow("网上股票交易系统"); |
| | | list<HWND> wlist = Win32Util::searchWindow("专业版下单"); |
| | | list<HWND>::iterator ele; |
| | | for (ele = wlist.begin();ele != wlist.end();ele++) { |
| | | HWND hwnd = *ele; |
New file |
| | |
| | | #include "TradeSuccessCapture.h" |
| | | #include <set> |
| | | #include "Win32Util.h" |
| | | OpenCLExcuter* BuySuccessCapture::openCLExcuter; |
| | | bool BuySuccessCapture::inited; |
| | | HWND BuySuccessCapture::win; |
| | | RecognitionManager* BuySuccessCapture::recognitionManager; |
| | | |
| | | //是否正在执行 |
| | | bool BuySuccessCapture::running; |
| | | |
| | | CallbackFun_Trade_Success BuySuccessCapture::data_callback; |
| | | |
| | | |
| | | void* BuySuccessCapture::context; |
| | | |
| | | void BuySuccessCapture::_run() { |
| | | while (true) { |
| | | //1s一次 |
| | | if (running && inited) { |
| | | clock_t start = clock(); |
| | | list<TradeSuccessData> datas = captureTradeSuccessInfo(); |
| | | cout << "耗时:" << clock() - start << " 数量:" << datas.size() << endl; |
| | | data_callback(datas, context); |
| | | datas.clear(); |
| | | Sleep(2000); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | cv::Mat BuySuccessCapture::grayImgs(cv::Mat oimg) { |
| | | cv::Mat grayImg = cv::Mat::zeros(oimg.rows, oimg.cols, CV_8UC1);//ImgUtil::grayImage(oimg); |
| | | |
| | | uchar* imgData = (uchar*)malloc(sizeof(uchar) * oimg.rows * oimg.cols); |
| | | if (oimg.channels() == 3) |
| | | { |
| | | openCLExcuter->rgb2ThresholdInvert(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | else { |
| | | openCLExcuter->rgba2ThresholdInvert(oimg.data, oimg.cols, oimg.rows, imgData); |
| | | } |
| | | grayImg.data = imgData; |
| | | |
| | | return grayImg; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | void BuySuccessCapture::init(CallbackFun_Trade_Success callback, void* contex) { |
| | | data_callback = callback; |
| | | context = contex; |
| | | running = false; |
| | | |
| | | recognitionManager = new RecognitionManager(); |
| | | openCLExcuter = new OpenCLExcuter(); |
| | | openCLExcuter->init(); |
| | | |
| | | thread rt(&(BuySuccessCapture::_run)); |
| | | rt.detach(); |
| | | inited = true; |
| | | try { |
| | | refreshHWND(); |
| | | } |
| | | catch (...) { |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | void BuySuccessCapture::refreshHWND() { |
| | | HWND hwnd = THSActionUtil::getTradeWindow(); |
| | | if (hwnd <= 0) |
| | | throw string("同花顺专业下单页面未打开"); |
| | | |
| | | HWND content = GetDlgItem(hwnd, 0x00002EE6); |
| | | |
| | | |
| | | if (content <= 0) |
| | | throw string("未获取到内容窗口句柄"); |
| | | |
| | | win = content; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | list<TradeSuccessData> BuySuccessCapture::captureTradeSuccessInfo(cv::Mat oimg) { |
| | | cv::Mat grayImg = grayImgs(oimg); |
| | | list<TradeSuccessData> dataList; |
| | | //分隔元素 |
| | | int empty_start = -1; |
| | | int empty_end = -1; |
| | | int data_start = -1; |
| | | int data_end = -1; |
| | | list<int*> rowData; |
| | | for (int r = 0;r < grayImg.rows;r++) { |
| | | if (ImgDivider::isRowEmpty(grayImg, r, 0, 50)) { |
| | | |
| | | if (empty_start < 0) { |
| | | empty_start = r; |
| | | empty_end = r; |
| | | } |
| | | else { |
| | | empty_end = r; |
| | | } |
| | | if (data_start > -1 && data_end > -1 && data_end - data_start > 5) { |
| | | printf("%d-%d\n", data_start, data_end); |
| | | int* d = (int*)malloc(sizeof(int) * 2); |
| | | d[0] = data_start; |
| | | d[1] = data_end; |
| | | rowData.push_back(d); |
| | | data_start = -1; |
| | | data_end = -1; |
| | | } |
| | | } |
| | | else { |
| | | empty_start = -1; |
| | | empty_end = -1; |
| | | |
| | | if (data_start < 0) { |
| | | data_start = r; |
| | | data_end = r; |
| | | } |
| | | else { |
| | | data_end = r; |
| | | } |
| | | } |
| | | } |
| | | //ȥͷȥβ |
| | | list<int*>::iterator start = rowData.begin(); |
| | | list<int*>::iterator end = rowData.end(); |
| | | free(*start); |
| | | rowData.erase(start); |
| | | std::advance(end, - 1); |
| | | free(*end); |
| | | rowData.erase(end); |
| | | |
| | | |
| | | int* rowIndex = (int*)malloc(sizeof(int) * rowData.size() * 4); |
| | | |
| | | int index = 0; |
| | | for (list<int*>::iterator ele = rowData.begin();ele != rowData.end();ele++) { |
| | | rowIndex[index * 4 + 0] = 0; |
| | | rowIndex[index * 4 + 1] = (*ele)[0]; |
| | | rowIndex[index * 4 + 2] = grayImg.cols-1; |
| | | rowIndex[index * 4 + 3] = (*ele)[1]; |
| | | free(*ele); |
| | | index++; |
| | | } |
| | | |
| | | |
| | | int ele_count_per_line = 7; |
| | | int length_per_num = 10; |
| | | |
| | | |
| | | int* splitResult = (int*)malloc(sizeof(int) * 4 * ele_count_per_line * rowData.size()); |
| | | |
| | | openCLExcuter->splitPlateContentRowData(grayImg.data, grayImg.cols, grayImg.rows, rowIndex, rowData.size(), ele_count_per_line, 0, 6, splitResult); |
| | | |
| | | if (false) { |
| | | //保存分隔结果 |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | int start = i * ele_count_per_line * 4; |
| | | for (int j = 0;j < ele_count_per_line;j++) |
| | | { |
| | | |
| | | int startx = splitResult[start]; |
| | | int starty = splitResult[start + 1]; |
| | | int endx = splitResult[start + 2]; |
| | | int endy = splitResult[start + 3]; |
| | | start += 4; |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\trade\\"; |
| | | path.append(to_string(i)).append("_").append(to_string(j)).append(".jpg"); |
| | | cv::imwrite(path, cv::Mat(grayImg, cv::Rect(startx, starty, endx - startx + 1, endy - starty + 1))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //分割数字 |
| | | unsigned char* zeroData = (unsigned char*)malloc(sizeof(unsigned char) * _NUMBER_L2_WIDTH * _NUMBER_L2_HEIGHT); |
| | | for (int r = 0;r < _NUMBER_L2_HEIGHT;r++) { |
| | | for (int c = 0;c < _NUMBER_L2_WIDTH;c++) |
| | | { |
| | | zeroData[r * _NUMBER_L2_WIDTH + c] = ImgUtil::NUMS_LEVEL2[0].data.ptr<uchar>(r)[c]; |
| | | } |
| | | } |
| | | |
| | | int line_number_count = ele_count_per_line * length_per_num; |
| | | |
| | | unsigned char* totalNumberData = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_L2_HEIGHT * rowData.size()) * _NUMBER_L2_WIDTH * 10 * line_number_count); |
| | | |
| | | UcharDataInfo typesData = UcharDataInfo(); |
| | | unsigned char types[] = { NUM_TYPE_CODE,NUM_TYPE_CODE,NUM_TYPE_TIME,NUM_TYPE_CODE,NUM_TYPE_PRICE,NUM_TYPE_CODE }; |
| | | typesData.length = ele_count_per_line; |
| | | typesData.data = types; |
| | | |
| | | openCLExcuter->splitL2NumNew(grayImg, IntDataInfo({ splitResult,(int)(ele_count_per_line * rowData.size()) }), UcharDataInfo({ totalNumberData, -1 }), typesData, zeroData, _NUMBER_L2_WIDTH, _NUMBER_L2_HEIGHT, ele_count_per_line, length_per_num); |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //识别数字 |
| | | uchar* templateNums = (unsigned char*)malloc(sizeof(unsigned char) * (_NUMBER_L2_HEIGHT * rowData.size()) * _NUMBER_L2_WIDTH * 10 * line_number_count); |
| | | openCLExcuter->createNumberTemplates(rowData.size(), _NUMBER_L2_WIDTH, _NUMBER_L2_HEIGHT, line_number_count, ImgUtil::numsOneLevel_level2, templateNums); |
| | | uchar** numberResult = openCLExcuter->recognition_numbers(totalNumberData, templateNums, rowData.size() * _NUMBER_L2_HEIGHT, _NUMBER_L2_WIDTH * 10 * line_number_count, _NUMBER_L2_WIDTH, _NUMBER_L2_HEIGHT, line_number_count); |
| | | |
| | | for (int i = 0;i < rowData.size();i++) { |
| | | TradeSuccessData industryData = TradeSuccessData(); |
| | | //日期 |
| | | string date = ""; |
| | | for (int j = length_per_num - 8;j < length_per_num;j++) |
| | | { |
| | | date.append(to_string(numberResult[i][length_per_num * 0 + j])); |
| | | } |
| | | |
| | | //代码 |
| | | string code = ""; |
| | | for (int j = length_per_num - 6;j < length_per_num;j++) |
| | | { |
| | | code.append(to_string(numberResult[i][length_per_num * 1 + j])); |
| | | } |
| | | |
| | | //时间 |
| | | string time = ""; |
| | | for (int j = length_per_num - 6;j < length_per_num;j++) |
| | | { |
| | | if (j - (length_per_num - 6) == 2 || j - (length_per_num - 6) == 4) |
| | | time.append(":"); |
| | | time.append(to_string(numberResult[i][length_per_num * 2 + j])); |
| | | } |
| | | //数量 |
| | | string num = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | num.append(to_string(numberResult[i][length_per_num * 3 + j])); |
| | | } |
| | | num = to_string(stoi(num)); |
| | | |
| | | //金额 |
| | | string money = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | if (j == length_per_num - 2) { |
| | | money.append("."); |
| | | } |
| | | money.append(to_string(numberResult[i][length_per_num * 4 + j])); |
| | | } |
| | | |
| | | char* chCode; |
| | | chCode = new char[20]; |
| | | sprintf_s(chCode, money.length(), "%.2lf", stod(money)); |
| | | std::string str(chCode); |
| | | money = str; |
| | | |
| | | //合同编号 |
| | | string trade_num = ""; |
| | | for (int j = 0;j < length_per_num;j++) |
| | | { |
| | | trade_num.append(to_string(numberResult[i][length_per_num * 5 + j])); |
| | | } |
| | | |
| | | //买入卖出 |
| | | int start = i * 4 * ele_count_per_line + 6 * 4; |
| | | int startx = splitResult[start]; |
| | | int starty = splitResult[start + 1]; |
| | | int endx = splitResult[start + 2]; |
| | | int endy = splitResult[start + 3]; |
| | | |
| | | int count = 0; |
| | | for (int r = starty;r <= endy;r++) { |
| | | for (int c = startx;c <= endx;c++) { |
| | | uchar v = grayImg.ptr<uchar>(r)[c]; |
| | | if (v >= _IMG_BINARY_THRESHOLD) { |
| | | count++; |
| | | } |
| | | } |
| | | } |
| | | if (count > 50) { |
| | | //卖出 |
| | | industryData.type = TRADE_TYPE_SELL; |
| | | } |
| | | else { |
| | | //买入 |
| | | industryData.type = TRADE_TYPE_BUY; |
| | | } |
| | | |
| | | |
| | | industryData.index = i; |
| | | industryData.date = date; |
| | | industryData.code = code; |
| | | industryData.time = time; |
| | | industryData.num = num; |
| | | industryData.money = money; |
| | | industryData.trade_num = trade_num; |
| | | |
| | | |
| | | |
| | | dataList.push_back(industryData); |
| | | free(numberResult[i]); |
| | | } |
| | | |
| | | |
| | | free(numberResult); |
| | | free(rowIndex); |
| | | free(splitResult); |
| | | free(zeroData); |
| | | free(templateNums); |
| | | free(grayImg.data); |
| | | grayImg.release(); |
| | | return dataList; |
| | | } |
| | | |
| | | |
| | | |
| | | list<TradeSuccessData> BuySuccessCapture::captureTradeSuccessInfo() { |
| | | cv::Mat oimg = CaptureUtil::capture(win); |
| | | if (oimg.cols < 10 || oimg.rows < 10) { |
| | | throw string("截图出错"); |
| | | } |
| | | list<TradeSuccessData> codes = captureTradeSuccessInfo(oimg); |
| | | return codes; |
| | | } |
| | | |
| | | bool BuySuccessCapture::isInited() { |
| | | return inited; |
| | | } |
| | | |
| | | bool BuySuccessCapture::isRunning() { |
| | | return running; |
| | | } |
| | | |
| | | |
| | | |
| | | //全部开始 |
| | | void BuySuccessCapture::start() { |
| | | running = true; |
| | | } |
| | | //全部结束 |
| | | void BuySuccessCapture::stop() { |
| | | running = false; |
| | | } |
New file |
| | |
| | | #pragma once |
| | | #include <string> |
| | | #include <iostream> |
| | | #include <list> |
| | | #include "ImgUtil.h" |
| | | #include "RecognitionManager.h" |
| | | #include "THSActionUtil.h" |
| | | |
| | | enum TradeType |
| | | { |
| | | TRADE_TYPE_BUY, |
| | | TRADE_TYPE_SELL, |
| | | }; |
| | | |
| | | |
| | | struct TradeSuccessData |
| | | { |
| | | string date; |
| | | string code; |
| | | string time; |
| | | string num; |
| | | string money; |
| | | string trade_num; |
| | | TradeType type; |
| | | //辅助功能 |
| | | int index; |
| | | }; |
| | | |
| | | typedef void (*CallbackFun_Trade_Success)(list<TradeSuccessData> dataList, void* contex); |
| | | |
| | | |
| | | class BuySuccessCapture |
| | | { |
| | | private: |
| | | static OpenCLExcuter* openCLExcuter; |
| | | static RecognitionManager* recognitionManager; |
| | | static bool inited; |
| | | |
| | | //是否正在执行 |
| | | static bool running; |
| | | static CallbackFun_Trade_Success data_callback; |
| | | static void* context; |
| | | static void _run(); |
| | | |
| | | static HWND win; |
| | | |
| | | |
| | | |
| | | |
| | | public: |
| | | void init(CallbackFun_Trade_Success callback, void* context); |
| | | void refreshHWND(); |
| | | static cv::Mat grayImgs(cv::Mat img); |
| | | |
| | | static list<TradeSuccessData> captureTradeSuccessInfo(cv::Mat img); |
| | | |
| | | static list<TradeSuccessData> captureTradeSuccessInfo(); |
| | | |
| | | bool isInited(); |
| | | |
| | | bool isRunning(); |
| | | //开始 |
| | | void start(); |
| | | //结束 |
| | | void stop(); |
| | | }; |
| | | |
| | |
| | | } |
| | | //分隔数据 |
| | | |
| | | //最大分割6个数 |
| | | //最大分割20个数 |
| | | int numCount = 0; |
| | | //记录分割得到的数据 |
| | | int numberCols[12]; |
| | | int numberCols[20*2]; |
| | | |
| | | int i; |
| | | for (i = 0;i < 3;i++) { |
| | |
| | | } |
| | | |
| | | int zeroCount = length_per_num - numCount; |
| | | //最大为10位数 |
| | | int fresult[10 * 2]; |
| | | //最大为20位数 |
| | | int fresult[20 * 2]; |
| | | for (i = 0;i < zeroCount;i++) { |
| | | fresult[i * 2] = -1; |
| | | fresult[i * 2 + 1] = -1; |
| | |
| | | int rowIndex = index / ele_count_per_line; |
| | | int index_0 = rowDataCount * rowIndex; |
| | | //行偏移量 |
| | | int index_2 = (num_width * 10) * ( 6 * (index % ele_count_per_line) + i); |
| | | int index_2 = (num_width * 10) * (length_per_num * (index % ele_count_per_line) + i); |
| | | |
| | | for (int re = 0;re < 10;re++) { |
| | | int index_3 = re * num_width; |
| | |
| | | |
| | | //printf("\n"); |
| | | } |
| | | |
| | | |
| | | __kernel void split_l2_num_new(__global const unsigned char* img_in, __global const int* pos_in, __global const unsigned char* zero, __global const unsigned char* types, int width, int num_width, int num_height, int ele_count_per_line, int length_per_num, |
| | | __global unsigned char* result) { |
| | | |
| | | //printf("ele_count_per_line:%d length_per_num:%d\n", ele_count_per_line, length_per_num); |
| | | |
| | | int index = get_global_id(0); |
| | | //区域坐标 |
| | | int startP = index * 4; |
| | | int startx = pos_in[startP]; |
| | | int starty = pos_in[startP + 1]; |
| | | int endx = pos_in[startP + 2]; |
| | | int endy = pos_in[startP + 3]; |
| | | |
| | | if (startx > 0) |
| | | { |
| | | int startNy = -1; |
| | | int endNy = -1; |
| | | //去除上下的白边 |
| | | int y = 0; |
| | | for (y = starty;y <= endy;y++) { |
| | | bool empty = 1; |
| | | for (int x = startx;x <= endx;x++) |
| | | { |
| | | int p = get_one_level_position(width, x, y); |
| | | unsigned char value = get_binary_value(img_in[p]); |
| | | //有数据 |
| | | if (value > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (!empty) { |
| | | startNy = y; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (y = endy;y >= starty;y--) { |
| | | bool empty = 1; |
| | | for (int x = startx;x <= endx;x++) |
| | | { |
| | | int p = get_one_level_position(width, x, y); |
| | | unsigned char value = get_binary_value(img_in[p]); |
| | | //有数据 |
| | | if (value > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (!empty) { |
| | | endNy = y; |
| | | break; |
| | | } |
| | | } |
| | | starty = startNy; |
| | | endy = endNy; |
| | | } |
| | | int cols = endx - startx + 1; |
| | | int rows = endy - starty + 1; |
| | | |
| | | //每个元素占用6个数字的空间,不够的前面填充0 |
| | | int num_count = ele_count_per_line * length_per_num; |
| | | |
| | | int nps[12]; |
| | | //只能识别4种数字 |
| | | unsigned char type = types[index % ele_count_per_line]; |
| | | //printf("ele_count_line:%d\n", ele_count_line); |
| | | //时间 |
| | | if (type == 0) { |
| | | //时间 |
| | | int s = cols / 2; |
| | | int i; |
| | | //往前查找冒号 |
| | | int m1_s = -1, m1_e = -1, m2_s = -1, m2_e = -1; |
| | | uchar temp[7]; |
| | | for (i = s;i > -1;i--) { |
| | | if (i < 6) { |
| | | break; |
| | | } |
| | | temp[0] = get_binary_value(img_in[get_one_level_position(width, startx + i, endy)]); |
| | | |
| | | temp[1] = get_binary_value(img_in[get_one_level_position(width, startx + i - 1, endy)]); |
| | | |
| | | |
| | | temp[2] = get_binary_value(img_in[get_one_level_position(width, startx + i - 2, endy)]); |
| | | temp[3] = get_binary_value(img_in[get_one_level_position(width, startx + i - 3, endy)]); |
| | | temp[4] = get_binary_value(img_in[get_one_level_position(width, startx + i - 4, endy)]); |
| | | temp[5] = get_binary_value(img_in[get_one_level_position(width, startx + i - 5, endy)]); |
| | | temp[6] = get_binary_value(img_in[get_one_level_position(width, startx + i - 6, endy)]); |
| | | if (temp[3] > 0 && get_binary_value(img_in[get_one_level_position(width, startx + i - 3, endy - 1)]) == 0) { |
| | | int t = temp[0] + temp[1] + temp[2] + temp[4] + temp[5] + temp[6]; |
| | | if (t == 0) { |
| | | m1_s = i - 6; |
| | | m1_e = i; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | //往后查找冒号 |
| | | |
| | | for (i = s;i < cols;i++) { |
| | | if (i > cols - 6) { |
| | | break; |
| | | } |
| | | |
| | | temp[0] = get_binary_value(img_in[get_one_level_position(width, startx + i, endy)]); |
| | | temp[1] = get_binary_value(img_in[get_one_level_position(width, startx + i + 1, endy)]); |
| | | temp[2] = get_binary_value(img_in[get_one_level_position(width, startx + i + 2, endy)]); |
| | | temp[3] = get_binary_value(img_in[get_one_level_position(width, startx + i + 3, endy)]); |
| | | temp[4] = get_binary_value(img_in[get_one_level_position(width, startx + i + 4, endy)]); |
| | | temp[5] = get_binary_value(img_in[get_one_level_position(width, startx + i + 5, endy)]); |
| | | temp[6] = get_binary_value(img_in[get_one_level_position(width, startx + i + 6, endy)]); |
| | | if (temp[3] > 0 && get_binary_value(img_in[get_one_level_position(width, startx + i + 3, endy - 1)]) == 0) { |
| | | int t = temp[0] + temp[1] + temp[2] + temp[4] + temp[5] + temp[6]; |
| | | if (t == 0) { |
| | | m2_s = i; |
| | | m2_e = i + 6; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (m1_s < 0 || m1_e < 0 || m2_s < 0 || m2_e < 0) { |
| | | //没有分割成功的话填充0 |
| | | nps[0] = -1; |
| | | nps[1] = -1; |
| | | nps[2] = -1; |
| | | nps[3] = -1; |
| | | |
| | | nps[4] = -1; |
| | | nps[5] = -1; |
| | | nps[6] = -1; |
| | | nps[7] = -1; |
| | | |
| | | nps[8] = -1; |
| | | nps[9] = -1; |
| | | nps[10] = -1; |
| | | nps[11] = -1; |
| | | } |
| | | else { |
| | | //3个时间的坐标 |
| | | nps[0] = startx; |
| | | nps[1] = starty; |
| | | nps[2] = startx + m1_s - 1; |
| | | nps[3] = endy; |
| | | |
| | | nps[4] = startx + m1_e + 1; |
| | | nps[5] = starty; |
| | | nps[6] = startx + m2_s - 1; |
| | | nps[7] = endy; |
| | | |
| | | nps[8] = startx + m2_e + 1; |
| | | nps[9] = starty; |
| | | nps[10] = endx; |
| | | nps[11] = endy; |
| | | } |
| | | |
| | | |
| | | } |
| | | //金额 |
| | | else if (type == 1) { |
| | | //查找单位前的空格 |
| | | int num_end = -1; |
| | | int i; |
| | | for (i = endx - 9;i >= startx;i--) { |
| | | bool empty = 1; |
| | | for (int y = starty;y < endy;y++) { |
| | | if (get_binary_value(img_in[get_one_level_position(width, i, y)]) > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (empty) { |
| | | num_end = i - 1; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (num_end >= 0) { |
| | | endx = num_end; |
| | | } |
| | | |
| | | //去除上下的空白 |
| | | int startNy = -1; |
| | | int endNy = -1; |
| | | //去除上下的白边 |
| | | int y = 0; |
| | | for (y = starty;y <= endy;y++) { |
| | | bool empty = 1; |
| | | for (int x = startx;x <= endx;x++) |
| | | { |
| | | int p = get_one_level_position(width, x, y); |
| | | unsigned char value = get_binary_value(img_in[p]); |
| | | //有数据 |
| | | if (value > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (!empty) { |
| | | startNy = y; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | for (y = endy;y >= starty;y--) { |
| | | bool empty = 1; |
| | | for (int x = startx;x <= endx;x++) |
| | | { |
| | | int p = get_one_level_position(width, x, y); |
| | | unsigned char value = get_binary_value(img_in[p]); |
| | | //有数据 |
| | | if (value > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | if (!empty) { |
| | | endNy = y; |
| | | break; |
| | | } |
| | | } |
| | | starty = startNy; |
| | | endy = endNy; |
| | | |
| | | |
| | | |
| | | cols = endx - startx + 1; |
| | | |
| | | |
| | | |
| | | //查找小数点 |
| | | int m_s = -1, m_e = -1; |
| | | uchar temp[6]; |
| | | for (i = 0;i < cols;i++) { |
| | | if (i > cols - 5) { |
| | | break; |
| | | } |
| | | temp[0] = get_binary_value(img_in[get_one_level_position(width, startx + i, endy)]); |
| | | |
| | | temp[1] = get_binary_value(img_in[get_one_level_position(width, startx + i + 1, endy)]); |
| | | temp[2] = get_binary_value(img_in[get_one_level_position(width, startx + i + 2, endy)]); |
| | | temp[3] = get_binary_value(img_in[get_one_level_position(width, startx + i + 3, endy)]); |
| | | temp[4] = get_binary_value(img_in[get_one_level_position(width, startx + i + 4, endy)]); |
| | | temp[5] = get_binary_value(img_in[get_one_level_position(width, startx + i + 5, endy)]); |
| | | if (temp[2] > 0) { |
| | | |
| | | bool empty = 1; |
| | | for (int y = starty;y < endy;y++) { |
| | | if (get_binary_value(img_in[get_one_level_position(width, startx + i + 2, y)]) > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | //小数点上方为空值 |
| | | if (empty) { |
| | | unsigned char t = temp[0] + temp[1] + temp[3] + temp[4] + temp[5]; |
| | | if (t == 0) { |
| | | m_s = i; |
| | | m_e = i + 5; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (m_s == -1 || m_e == -1) { |
| | | nps[0] = -1; |
| | | nps[1] = -1; |
| | | nps[2] = -1; |
| | | nps[3] = -1; |
| | | |
| | | nps[4] = -1; |
| | | nps[5] = -1; |
| | | nps[6] = -1; |
| | | nps[7] = -1; |
| | | } |
| | | else { |
| | | nps[0] = startx; |
| | | nps[1] = starty; |
| | | nps[2] = startx + m_s - 1; |
| | | nps[3] = endy; |
| | | |
| | | nps[4] = startx + m_e + 1; |
| | | nps[5] = starty; |
| | | nps[6] = num_end; |
| | | nps[7] = endy; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | //价格 |
| | | else if (type == 2) { |
| | | //股价 |
| | | |
| | | //printf("startx:%d starty:%d endx:%d endy:%d\n",startx,starty,endx,endy); |
| | | |
| | | int m_s = -1, m_e = -1; |
| | | uchar temp[6]; |
| | | int i; |
| | | for (i = 0;i < cols;i++) { |
| | | if (i > cols - 5) { |
| | | break; |
| | | } |
| | | temp[0] = get_binary_value(img_in[get_one_level_position(width, startx + i, endy)]); |
| | | |
| | | temp[1] = get_binary_value(img_in[get_one_level_position(width, startx + i + 1, endy)]); |
| | | temp[2] = get_binary_value(img_in[get_one_level_position(width, startx + i + 2, endy)]); |
| | | temp[3] = get_binary_value(img_in[get_one_level_position(width, startx + i + 3, endy)]); |
| | | temp[4] = get_binary_value(img_in[get_one_level_position(width, startx + i + 4, endy)]); |
| | | temp[5] = get_binary_value(img_in[get_one_level_position(width, startx + i + 5, endy)]); |
| | | if (temp[2] > 0) { |
| | | |
| | | bool empty = 1; |
| | | for (int y = starty;y < endy;y++) { |
| | | if (get_binary_value(img_in[get_one_level_position(width, startx + i + 2, y)]) > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | //小数点上方为空值 |
| | | if (empty) { |
| | | unsigned char t = temp[0] + temp[1] + temp[3] + temp[4] + temp[5]; |
| | | if (t == 0) { |
| | | m_s = i; |
| | | m_e = i + 5; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (m_s == -1 || m_e == -1) { |
| | | nps[0] = -1; |
| | | nps[1] = -1; |
| | | nps[2] = -1; |
| | | nps[3] = -1; |
| | | |
| | | nps[4] = -1; |
| | | nps[5] = -1; |
| | | nps[6] = -1; |
| | | nps[7] = -1; |
| | | |
| | | nps[8] = -1; |
| | | nps[9] = -1; |
| | | nps[10] = -1; |
| | | nps[11] = -1; |
| | | } |
| | | else { |
| | | nps[0] = startx; |
| | | nps[1] = starty; |
| | | nps[2] = startx + m_s - 1; |
| | | nps[3] = endy; |
| | | |
| | | nps[4] = startx + m_e + 1; |
| | | nps[5] = starty; |
| | | nps[6] = endx; |
| | | nps[7] = endy; |
| | | |
| | | nps[8] = -1; |
| | | nps[9] = -1; |
| | | nps[10] = -1; |
| | | nps[11] = -1; |
| | | } |
| | | |
| | | } |
| | | //代码 |
| | | else if (type == 3) { |
| | | //手数 |
| | | nps[0] = startx; |
| | | nps[1] = starty; |
| | | nps[2] = endx; |
| | | nps[3] = endy; |
| | | |
| | | nps[4] = -1; |
| | | nps[5] = -1; |
| | | nps[6] = -1; |
| | | nps[7] = -1; |
| | | |
| | | nps[8] = -1; |
| | | nps[9] = -1; |
| | | nps[10] = -1; |
| | | nps[11] = -1; |
| | | } |
| | | //分隔数据 |
| | | |
| | | //最大分割20个数 |
| | | int numCount = 0; |
| | | //记录分割得到的数据 |
| | | int numberCols[20*2]; |
| | | |
| | | int i; |
| | | for (i = 0;i < 3;i++) { |
| | | if (nps[i * 4] == -1) { |
| | | break; |
| | | } |
| | | int _startx = nps[i * 4]; |
| | | int _starty = nps[i * 4 + 1]; |
| | | int _endx = nps[i * 4 + 2]; |
| | | int _endy = nps[i * 4 + 3]; |
| | | int _cols = _endx - _startx + 1; |
| | | |
| | | |
| | | |
| | | int c, startC = -1, endC = -1; |
| | | for (c = 0;c < _cols;c++) { |
| | | |
| | | bool empty = 1; |
| | | for (int y = _starty;y <= _endy;y++) { |
| | | unsigned char value = get_binary_value(img_in[get_one_level_position(width, _startx + c, y)]); |
| | | if (value > 0) { |
| | | empty = 0; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (empty) { |
| | | if (startC > -1 && endC > -1) { |
| | | numberCols[numCount * 2] = _startx + startC; |
| | | numberCols[numCount * 2 + 1] = _startx + endC; |
| | | numCount++; |
| | | } |
| | | startC = -1; |
| | | endC = -1; |
| | | } |
| | | else { |
| | | if (startC == -1) { |
| | | startC = c; |
| | | endC = c; |
| | | } |
| | | else { |
| | | endC = c; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (startC > -1 && endC > -1) { |
| | | numberCols[numCount * 2] = _startx + startC; |
| | | numberCols[numCount * 2 + 1] = _startx + endC; |
| | | numCount++; |
| | | } |
| | | } |
| | | |
| | | int zeroCount = length_per_num - numCount; |
| | | //最大为20位数 |
| | | int fresult[20 * 2]; |
| | | for (i = 0;i < zeroCount;i++) { |
| | | fresult[i * 2] = -1; |
| | | fresult[i * 2 + 1] = -1; |
| | | } |
| | | |
| | | for (i = 0;i < numCount;i++) { |
| | | fresult[(i + zeroCount) * 2] = numberCols[i * 2]; |
| | | fresult[(i + zeroCount) * 2 + 1] = numberCols[i * 2 + 1]; |
| | | } |
| | | |
| | | //开始填充数据 |
| | | for (i = 0;i < length_per_num;i++) { |
| | | |
| | | unsigned char numData[100 * 100]; |
| | | |
| | | if (fresult[i * 2] == -1) { |
| | | //填充0 |
| | | for (int r = 0;r < num_height;r++) { |
| | | for (int c = 0;c < num_width;c++) { |
| | | unsigned char value = get_binary_value(zero[r * num_width + c]); |
| | | //设置输出坐标的值 |
| | | numData[r * num_width + c] = value; |
| | | } |
| | | } |
| | | |
| | | } |
| | | else { |
| | | int _startx = fresult[i * 2]; |
| | | int _endx = fresult[i * 2 + 1]; |
| | | for (int r = starty;r <= endy;r++) { |
| | | for (int c = 0;c < num_width;c++) { |
| | | unsigned char value = 0; |
| | | if (_startx + c <= _endx) { |
| | | //填充空白0 |
| | | value = get_binary_value(img_in[get_one_level_position(width, _startx + c, r)]); |
| | | //设置输出坐标的值 |
| | | numData[(r - starty) * num_width + c] = value; |
| | | } |
| | | else { |
| | | numData[(r - starty) * num_width + c] = 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | int rowDataCount = num_height * num_width * 10 * num_count; |
| | | int rowIndex = index / ele_count_per_line; |
| | | int index_0 = rowDataCount * rowIndex; |
| | | //行偏移量 |
| | | int index_2 = (num_width * 10) * (length_per_num * (index % ele_count_per_line) + i); |
| | | |
| | | for (int re = 0;re < 10;re++) { |
| | | int index_3 = re * num_width; |
| | | for (int r = 0;r < num_height;r++) { |
| | | int index_1 = r * (num_width * 10 * num_count); |
| | | for (int c = 0;c < num_width;c++) { |
| | | int findex = index_0 + index_1 + index_2 + index_3 + c; |
| | | //printf("index:%d-findex:%d value:%d \n", index, findex, numData[r * num_width + c]); |
| | | result[findex] = numData[r * num_width + c]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | //printf("\n"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | //分割L2数字 |
| | |
| | | } |
| | | } |
| | | |
| | | __kernel void rgb2GrayImgInvert(__global unsigned char* imgs, int width, |
| | | __kernel void rgb2ThresholdInvert(__global unsigned char* imgs, int width, |
| | | __global unsigned char* result) { |
| | | |
| | | int rowIndex = get_global_id(0); |
| | |
| | | unsigned char R = imgs[start]; |
| | | unsigned char G = imgs[start + 1]; |
| | | unsigned char B = imgs[start + 2]; |
| | | result[index] = 255 - (76 * R + 150 * G + 30 * B) >> 8; |
| | | int v = (76 * R + 150 * G + 30 * B) >> 8; |
| | | |
| | | if (v > 64) { |
| | | result[index] = 0; |
| | | } |
| | | else { |
| | | result[index] = 255; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | __kernel void rgba2GrayImgInvert(__global unsigned char* imgs, int width, |
| | | __kernel void rgba2ThresholdInvert(__global unsigned char* imgs, int width, |
| | | __global unsigned char* result) { |
| | | |
| | | int rowIndex = get_global_id(0); |
| | |
| | | unsigned char R = imgs[start]; |
| | | unsigned char G = imgs[start + 1]; |
| | | unsigned char B = imgs[start + 2]; |
| | | result[index] =255 - (76 * R + 150 * G + 30 * B) >> 8; |
| | | int v = (76 * R + 150 * G + 30 * B) >> 8; |
| | | if (v > 64) { |
| | | result[index] = 0; |
| | | } |
| | | else { |
| | | result[index] = 255; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | #include "Win32Util.h" |
| | | #include "LimitUpCapture.h" |
| | | #include "IndustryCapture.h" |
| | | #include "TradeSuccessCapture.h" |
| | | void gray(); |
| | | void ths(); |
| | | /* |
| | |
| | | //SetWindowText(GetDlgItem(HWND(0x0002269E), 0x0000040A),TEXT("100")); |
| | | //Win32Util::focus(GetDlgItem(HWND(0x0002269E), 0x00000408)); |
| | | //Win32Util::keyboardNum("000333", 10); |
| | | ImgUtil::init(); |
| | | |
| | | cv::Mat img = CaptureUtil::capture(HWND(0x00020E12)); |
| | | cv::Mat grayImg = ImgUtil::grayImage(img); |
| | | string path = "C:\\Users\\Administrator\\Desktop\\ocr\\"; |
| | | path.append("order.jpg"); |
| | | cv::imwrite(path, grayImg); |
| | | |
| | | |
| | | BuySuccessCapture* buySuccessCapture = new BuySuccessCapture(); |
| | | //buySuccessCapture->init(Null,Null); |
| | | buySuccessCapture->captureTradeSuccessInfo(); |
| | | //cv::Mat grayImg = buySuccessCapture->grayImgs(cv::imread("C:\\Users\\Administrator\\Desktop\\ocr\\order_origin.jpg")); |
| | | return 0; |
| | | |
| | | ImgUtil::init(); |
| | |
| | | |
| | | IndustryCapture* industryCapture = new IndustryCapture(); |
| | | cout << "LimitUpCapture实例化" << endl; |
| | | industryCapture->init(); |
| | | //industryCapture->init(); |
| | | cout << "LimitUpCapture初始化完成" << endl; |
| | | |
| | | industryCapture->captureIndustryCodes(); |
| | |
| | | #include "json/json.h" |
| | | #include <THSActionUtil.h> |
| | | #include "LimitUpCapture.h" |
| | | #include "TradeSuccessCapture.h" |
| | | #include "IndustryCapture.h" |
| | | |
| | | class JsonUtil { |
| | | |
| | |
| | | } |
| | | data["data"] = _data; |
| | | Json::Value root; |
| | | root["type"] = 3; |
| | | root["type"] = 10; |
| | | root["client"] = clientID; |
| | | root["data"] = data; |
| | | return toJsonStr(root); |
| | |
| | | } |
| | | |
| | | |
| | | static std::string loadTradeSuccessData(list<TradeSuccessData> dataList) { |
| | | Json::Value root; |
| | | root["type"] = 3; |
| | | |
| | | |
| | | Json::Value data; |
| | | |
| | | std::list<TradeSuccessData>::iterator ele; |
| | | int index = 0; |
| | | for (ele = dataList.begin();ele != dataList.end();ele++) { |
| | | Json::Value item; |
| | | item["date"] = (*ele).date; |
| | | item["code"] = (*ele).code; |
| | | item["time"] = (*ele).time; |
| | | item["num"] = (*ele).num; |
| | | item["money"] = (*ele).money; |
| | | item["trade_num"] = (*ele).trade_num; |
| | | item["type"] = (*ele).type; |
| | | data[index++] = item; |
| | | } |
| | | |
| | | root["data"] = data; |
| | | |
| | | |
| | | return toJsonStr(root); |
| | | } |
| | | |
| | | static std::string loadIndustryData(list<list<IndustryData>> dataList) { |
| | | Json::Value root; |
| | | root["type"] = 4; |
| | | |
| | | |
| | | Json::Value data; |
| | | |
| | | std::list<list<IndustryData>>::iterator ele; |
| | | int index = 0; |
| | | for (ele = dataList.begin();ele != dataList.end();ele++) { |
| | | Json::Value item; |
| | | |
| | | int cindex = 0; |
| | | for (list<IndustryData >::iterator e = (*ele).begin();e != (*ele).end();e++) { |
| | | Json::Value item_c; |
| | | item_c["code"] = (*e).code; |
| | | item_c["zyltgb"] = (*e).zyltMoney; |
| | | item_c["zyltgb_unit"] = (*e).zyltMoneyUnit; |
| | | item[cindex++] = item_c; |
| | | } |
| | | data[index++] = item; |
| | | } |
| | | |
| | | root["data"] = data; |
| | | |
| | | |
| | | return toJsonStr(root); |
| | | } |
| | | |
| | | |
| | | static std::string loadGPCodeData(std::list<string> codeList) { |
| | | Json::Value root; |
| | | root["type"] = 1; |
| | |
| | | <ResourceCompile Include="app.rc" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="packages.config" /> |
| | | <None Include="res\app.rc2" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | |
| | | </ItemGroup> |
| | | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
| | | <ImportGroup Label="ExtensionTargets"> |
| | | <Import Project="..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets" Condition="Exists('..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets')" /> |
| | | <Import Project="..\packages\pthreads.2.9.1.4\build\native\pthreads.targets" Condition="Exists('..\packages\pthreads.2.9.1.4\build\native\pthreads.targets')" /> |
| | | </ImportGroup> |
| | | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |
| | | <PropertyGroup> |
| | | <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText> |
| | | </PropertyGroup> |
| | | <Error Condition="!Exists('..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\pthreads.redist.2.9.1.4\build\native\pthreads.redist.targets'))" /> |
| | | <Error Condition="!Exists('..\packages\pthreads.2.9.1.4\build\native\pthreads.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\pthreads.2.9.1.4\build\native\pthreads.targets'))" /> |
| | | </Target> |
| | | </Project> |
| | |
| | | <None Include="res\app.rc2"> |
| | | <Filter>资源文件</Filter> |
| | | </None> |
| | | <None Include="packages.config" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Image Include="res\app.ico"> |
| | |
| | | #include "tool.h" |
| | | #include "JsonUtil.h" |
| | | |
| | | |
| | | #ifdef _DEBUG |
| | | #define new DEBUG_NEW |
| | | #endif |
| | |
| | | capture = new L2DataCapture(); |
| | | recognitionManager = new RecognitionManager(); |
| | | limitUpCapture = new LimitUpCapture(); |
| | | buySuccessCapture = new BuySuccessCapture(); |
| | | industryCapture = new IndustryCapture(); |
| | | } |
| | | |
| | | void CappDlg::DoDataExchange(CDataExchange* pDX) |
| | |
| | | CDialogEx::DoDataExchange(pDX); |
| | | DDX_Control(pDX, IDC_CHECK2, limitUpUpload); |
| | | DDX_Control(pDX, IDC_BUTTON12, limitUpBtn); |
| | | DDX_Control(pDX, IDC_BUTTON_TRADE, tradeBtn); |
| | | DDX_Control(pDX, IDC_INDUSTRY, industryBtn); |
| | | } |
| | | |
| | | BEGIN_MESSAGE_MAP(CappDlg, CDialogEx) |
| | |
| | | ON_BN_CLICKED(IDC_BUTTON7, &CappDlg::OnBnClickedButton7) |
| | | ON_BN_CLICKED(IDC_BUTTON8, &CappDlg::OnBnClickedButton8) |
| | | ON_BN_CLICKED(IDC_BUTTON12, &CappDlg::OnBnClickedButton12) |
| | | ON_BN_CLICKED(IDC_BUTTON_TRADE, &CappDlg::OnBnClickedButtonTrade) |
| | | ON_BN_CLICKED(IDC_INDUSTRY, &CappDlg::OnBnClickedIndustry) |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | app->socketManager->sendMsg(index, data.c_str()); |
| | | } |
| | | catch (string st) { |
| | | //重新连接服务器 |
| | | //重新连接服务器 |
| | | app->socketManager->resetClient(index); |
| | | app->socketManager->Connect(index); |
| | | } |
| | | cout<<"*****数据处理时间:"<<(clock()- time_start)<<endl; |
| | | cout << "*****数据处理时间:" << (clock() - time_start) << endl; |
| | | } |
| | | } |
| | | |
| | |
| | | string data = JsonUtil::loadLimitUpData(dataList); |
| | | clock_t time_start = clock(); |
| | | try { |
| | | app->socketManager->sendMsg(8,data.c_str()); |
| | | app->socketManager->sendMsg(8, data.c_str()); |
| | | } |
| | | catch (string st) { |
| | | //重新连接服务器 |
| | |
| | | cout << "####涨停数据处理时间:" << (clock() - time_start) << endl; |
| | | } |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnTradeSuccessDataCallback(list<TradeSuccessData> dataList, void* context) { |
| | | //转为json |
| | | CappDlg* app = (CappDlg*)context; |
| | | //cout << "回调:" << std::this_thread::get_id() << ":" << index << endl; |
| | | CButton* btn = (CButton*)app->GetDlgItem(IDC_CHECK3); |
| | | bool check = btn->GetCheck(); |
| | | if (check) { |
| | | string data = JsonUtil::loadTradeSuccessData(dataList); |
| | | clock_t time_start = clock(); |
| | | try { |
| | | app->socketManager->sendMsg(8, data.c_str()); |
| | | } |
| | | catch (string st) { |
| | | //重新连接服务器 |
| | | app->socketManager->resetClient(8); |
| | | app->socketManager->Connect(8); |
| | | } |
| | | cout << "####交易成功数据处理时间:" << (clock() - time_start) << endl; |
| | | } |
| | | } |
| | | |
| | | |
| | | void CappDlg::OnIndustryDataCallback(list<IndustryData> dataList, void* context) { |
| | | //转为json |
| | | CappDlg* app = (CappDlg*)context; |
| | | //cout << "回调:" << std::this_thread::get_id() << ":" << index << endl; |
| | | CButton* btn = (CButton*)app->GetDlgItem(IDC_CHECK3); |
| | | |
| | | list<list<IndustryData>> _list; |
| | | _list.push_back(dataList); |
| | | |
| | | string data = JsonUtil::loadIndustryData(_list); |
| | | try { |
| | | app->socketManager->sendMsg(8, data.c_str()); |
| | | //AfxMessageBox(_T("上传成功")); |
| | | } |
| | | catch (string st) { |
| | | //重新连接服务器 |
| | | app->socketManager->resetClient(8); |
| | | app->socketManager->Connect(8); |
| | | } |
| | | dataList.clear(); |
| | | _list.clear(); |
| | | } |
| | | |
| | | |
| | | |
| | | bool CappDlg::OnActionCallback(string data, void* context) { |
| | |
| | | //CString msg(e.c_str()); |
| | | //AfxMessageBox(msg); |
| | | throw e; |
| | | }catch (...) { |
| | | } |
| | | catch (...) { |
| | | throw string("未知错误"); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | catch (string st) { |
| | | |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | if (!capture->isInited()) |
| | | { |
| | | try { |
| | | capture->init(OnL2DataCallback,OnTradeQueueDataCallback, this); |
| | | capture->init(OnL2DataCallback, OnTradeQueueDataCallback, this); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | |
| | | } |
| | | clock_t time = clock(); |
| | | |
| | | CString path= GUITool::selectImage(); |
| | | std:string p = cstring2String(path); |
| | | CString path = GUITool::selectImage(); |
| | | std:string p = cstring2String(path); |
| | | if (p.length() <= 0) { |
| | | return; |
| | | } |
| | |
| | | clock_t time = clock(); |
| | | |
| | | CString path = GUITool::selectImage(); |
| | | std:string p = cstring2String(path); |
| | | std:string p = cstring2String(path); |
| | | if (p.length() <= 0) { |
| | | return; |
| | | } |
| | |
| | | map<int, string> result = THSActionUtil::getListenL2GPCodes(recognitionManager); |
| | | //设置代码 |
| | | for (map<int, string>::iterator ele = result.begin();ele != result.end();ele++) { |
| | | int key= (*ele).first; |
| | | int key = (*ele).first; |
| | | string value = (*ele).second; |
| | | capture->setGPCode(key,value); |
| | | capture->setGPCode(key, value); |
| | | } |
| | | |
| | | } |
| | |
| | | return; |
| | | } |
| | | } |
| | | list<CString> paths= GUITool::selectMulImages(); |
| | | list<CString> paths = GUITool::selectMulImages(); |
| | | std::list<string> fResultList; |
| | | |
| | | |
| | | for (list<CString>::iterator ele = paths.begin();ele != paths.end();ele++) { |
| | | CString path = *ele; |
| | | std:string p = cstring2String(path); |
| | | std::list<string> resultList = THSActionUtil::recognitionGPCode(cv::imread(p), recognitionManager); |
| | | std:string p = cstring2String(path); |
| | | std::list<string> resultList = THSActionUtil::recognitionGPCode(cv::imread(p), recognitionManager); |
| | | for (std::list<string>::iterator ele1 = resultList.begin();ele1 != resultList.end();ele1++) { |
| | | bool contains = false; |
| | | for (std::list<string>::iterator e = fResultList.begin();e != fResultList.end();e++) { |
| | |
| | | try |
| | | { |
| | | limitUpCapture->init(OnLimitUpDataCallback, this); |
| | | |
| | | |
| | | } |
| | | catch (string st) |
| | | { |
| | |
| | | try |
| | | { |
| | | limitUpCapture->refreshHWND(); |
| | | }catch (string st) |
| | | } |
| | | catch (string st) |
| | | { |
| | | CString msg(st.c_str()); |
| | | AfxMessageBox(msg); |
| | |
| | | |
| | | |
| | | } |
| | | |
| | | //当日成交监控 |
| | | void CappDlg::OnBnClickedButtonTrade() |
| | | { |
| | | |
| | | |
| | | if (!buySuccessCapture->isInited()) { |
| | | try |
| | | { |
| | | buySuccessCapture->init(OnTradeSuccessDataCallback, this); |
| | | } |
| | | catch (string st) |
| | | { |
| | | CString msg(st.c_str()); |
| | | AfxMessageBox(msg); |
| | | return; |
| | | } |
| | | } |
| | | if ( |
| | | buySuccessCapture->isRunning()) { |
| | | buySuccessCapture->stop(); |
| | | tradeBtn.SetWindowTextW(_T("启动成交识别任务")); |
| | | } |
| | | else { |
| | | try |
| | | { |
| | | buySuccessCapture->refreshHWND(); |
| | | } |
| | | catch (string st) |
| | | { |
| | | CString msg(st.c_str()); |
| | | AfxMessageBox(msg); |
| | | return; |
| | | } |
| | | |
| | | buySuccessCapture->start(); |
| | | tradeBtn.SetWindowTextW(_T("暂停成交识别任务")); |
| | | } |
| | | } |
| | | |
| | | void* CappDlg::runCaptureIndustryCodes(void* context) { |
| | | CappDlg* app = (CappDlg*)context; |
| | | app->industryCapture->captureIndustryCodes(); |
| | | |
| | | return context; |
| | | } |
| | | |
| | | //行业代码识别 |
| | | void CappDlg::OnBnClickedIndustry() |
| | | { |
| | | |
| | | if (!industryCapture->isInited()) { |
| | | industryCapture->init(OnIndustryDataCallback, this); |
| | | } |
| | | try { |
| | | industryCapture->refreshHWND(); |
| | | } |
| | | catch (string st) { |
| | | CString msg(st.c_str()); |
| | | AfxMessageBox(msg); |
| | | return; |
| | | } |
| | | if (!industryPid.p) { |
| | | int ret = 0; |
| | | ret = pthread_create(&industryPid, NULL, &(CappDlg::runCaptureIndustryCodes), this); |
| | | if (ret != 0) { |
| | | AfxMessageBox(_T("创建运行线程失败")); |
| | | return; |
| | | } |
| | | pthread_detach(industryPid); |
| | | industryBtn.SetWindowTextW(_T("结束行业识别")); |
| | | } |
| | | else { |
| | | industryCapture->stop(); |
| | | int ret = pthread_cancel(industryPid); |
| | | industryPid.p = 0; |
| | | industryBtn.SetWindowTextW(_T("开始行业识别")); |
| | | } |
| | | } |
| | |
| | | #include "LimitUpCapture.h" |
| | | #include "CaptureUtil.h" |
| | | #include "RecognitionManager.h" |
| | | #include "TradeSuccessCapture.h" |
| | | #include "IndustryCapture.h" |
| | | #include "pthread.h" |
| | | #pragma comment(lib, "pthreadVC2.lib") |
| | | |
| | | |
| | | |
| | | |
| | |
| | | SocketManager *socketManager; |
| | | L2DataCapture* capture; |
| | | LimitUpCapture* limitUpCapture; |
| | | BuySuccessCapture* buySuccessCapture; |
| | | IndustryCapture* industryCapture; |
| | | |
| | | void OnDataCallback(int index, list<TradeData> dataList); |
| | | static void OnL2DataCallback(int index,string code, list<TradeData> dataList, void* context); |
| | | static void OnTradeQueueDataCallback(int index, string code, list<int> numList, void* context); |
| | | static void OnLimitUpDataCallback(list<LimitUpData> dataList, void* context); |
| | | static void OnTradeSuccessDataCallback(list<TradeSuccessData> dataList, void* context); |
| | | static void OnIndustryDataCallback(list<IndustryData> dataList, void* context); |
| | | static bool OnActionCallback(string data, void* context); |
| | | |
| | | static void *runCaptureIndustryCodes(void* context); |
| | | |
| | | pthread_t industryPid = pthread_t({ 0,0 }); |
| | | |
| | | |
| | | // 构造 |
| | |
| | | CButton limitUpUpload; |
| | | CButton limitUpBtn; |
| | | afx_msg void OnBnClickedButton12(); |
| | | CButton tradeBtn; |
| | | afx_msg void OnBnClickedButtonTrade(); |
| | | afx_msg void OnBnClickedIndustry(); |
| | | CButton industryBtn; |
| | | }; |
| | |
| | | #define IDC_EDIT2 1018 |
| | | #define IDC_CHECK2 1020 |
| | | #define IDC_BUTTON12 1021 |
| | | #define IDC_BUTTON_TRADE 1022 |
| | | #define IDC_CHECK3 1023 |
| | | #define IDC_INDUSTRY 1024 |
| | | |
| | | // Next default values for new objects |
| | | // |
| | |
| | | #ifndef APSTUDIO_READONLY_SYMBOLS |
| | | #define _APS_NEXT_RESOURCE_VALUE 134 |
| | | #define _APS_NEXT_COMMAND_VALUE 32771 |
| | | #define _APS_NEXT_CONTROL_VALUE 1022 |
| | | #define _APS_NEXT_CONTROL_VALUE 1025 |
| | | #define _APS_NEXT_SYMED_VALUE 101 |
| | | #endif |
| | | #endif |
New file |
| | |
| | | configurations { |
| | | Toolset { |
| | | key : "PlatformToolset"; |
| | | choices : { v110, v100 }; |
| | | }; |
| | | Platform { |
| | | key : "Platform"; |
| | | choices : { Win32, x64 }; |
| | | Win32.aliases : { x86, win32, ia32, 386 }; |
| | | x64.aliases : { x64, amd64, em64t, intel64, x86-64, x86_64 }; |
| | | }; |
| | | Configuration { |
| | | key : "Configuration"; |
| | | choices : { Release, Debug }; |
| | | }; |
| | | Linkage { |
| | | choices : { dynamic, static, ltcg }; |
| | | }; |
| | | CallingConvention { |
| | | choices : { cdecl, stdcall }; |
| | | }; |
| | | Other { |
| | | key : "OTHER_STUFF"; |
| | | choices : { RuntimeLibraryNull }; |
| | | }; |
| | | }; |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework"> |
| | | <Rule Name="ProjectSettings_globals" PageTemplate="tool" DisplayName="Project Master Settings" SwitchPrefix="/" Order="1"> |
| | | <Rule.Categories> |
| | | <Category Name="cpp" DisplayName="C/C++ Settings" /> |
| | | </Rule.Categories> |
| | | <Rule.DataSource> |
| | | <DataSource Persistence="ProjectFile" ItemType="" /> |
| | | </Rule.DataSource> |
| | | <EnumProperty Name="RuntimeLibrary" DisplayName="Runtime Library" Description="Specify runtime library for linking." Category="cpp" > |
| | | <EnumValue Name="MultiThreaded" DisplayName="Multi-threaded" Description="Causes your application to use the multithread, static version of the run-time library."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDebug" DisplayName="Multi-threaded Debug" Description="Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDLL" DisplayName="Multi-threaded DLL" Description="Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDebugDLL" DisplayName="Multi-threaded Debug DLL" Description="Defines _DEBUG, _MT, and _DLL and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file."> |
| | | </EnumValue> |
| | | </EnumProperty> |
| | | </Rule> |
| | | </ProjectSchemaDefinitions> |
New file |
| | |
| | | 2011-03-26 Ross Johnson <ross at homemail dot com dot au> |
| | | |
| | | * pthread_nutex_init.html (robust mutexes): Added |
| | | descriptions for newly implemented interface. |
| | | * pthread_mutexattr_init.html (robust mutexes): Likewise. |
| | | * pthread_getsequence_np.html: New. |
| | | * index.html: Updated. |
| | | |
| | | 2008-06-30 Ross Johnson <ross at callisto.canberra.edu.au> |
| | | |
| | | * pthread_setschedparam.html: Fix "see also" links. |
| | | |
| | | 2005-05-06 Ross Johnson <ross at callisto.canberra.edu.au> |
| | | |
| | | * PortabilityIssues.html: Was nonPortableIssues.html. |
| | | * index.html: Updated; add table of contents at top. |
| | | * *.html: Add Pthreads-win32 header info; add link back to the |
| | | index page 'index.html'. |
| | | |
| | | 2005-05-06 Ross Johnson <ross at callisto.canberra.edu.au> |
| | | |
| | | * index.html: New. |
| | | * nonPortableIssues.html: New. |
| | | * pthread_attr_init.html: New. |
| | | * pthread_attr_setstackaddr.html: New. |
| | | * pthread_attr_setstacksize.html: New. |
| | | * pthread_barrierattr_init.html: New. |
| | | * pthread_barrierattr_setpshared.html: New. |
| | | * pthread_barrier_init.html: New. |
| | | * pthread_barrier_wait.html: New. |
| | | * pthreadCancelableWait.html: New. |
| | | * pthread_cancel.html: New. |
| | | * pthread_cleanup_push.html: New. |
| | | * pthread_condattr_init.html: New. |
| | | * pthread_condattr_setpshared.html: New. |
| | | * pthread_cond_init.html: New. |
| | | * pthread_create.html: New. |
| | | * pthread_delay_np.html: New. |
| | | * pthread_detach.html: New. |
| | | * pthread_equal.html: New. |
| | | * pthread_exit.html: New. |
| | | * pthread_getw32threadhandle_np.html: New. |
| | | * pthread_join.html: New. |
| | | * pthread_key_create.html: New. |
| | | * pthread_kill.html: New. |
| | | * pthread_mutexattr_init.html: New. |
| | | * pthread_mutexattr_setpshared.html: New. |
| | | * pthread_mutex_init.html: New. |
| | | * pthread_num_processors_np.html: New. |
| | | * pthread_once.html: New. |
| | | * pthread_rwlockattr_init.html: New. |
| | | * pthread_rwlockattr_setpshared.html: New. |
| | | * pthread_rwlock_init.html: New. |
| | | * pthread_rwlock_rdlock.html: New. |
| | | * pthread_rwlock_timedrdlock.html: New. |
| | | * pthread_rwlock_timedwrlock.html: New. |
| | | * pthread_rwlock_unlock.html: New. |
| | | * pthread_rwlock_wrlock.html: New. |
| | | * pthread_self.html: New. |
| | | * pthread_setcancelstate.html: New. |
| | | * pthread_setcanceltype.html: New. |
| | | * pthread_setconcurrency.html: New. |
| | | * pthread_setschedparam.html: New. |
| | | * pthread_spin_init.html: New. |
| | | * pthread_spin_lock.html: New. |
| | | * pthread_spin_unlock.html: New. |
| | | * pthread_timechange_handler_np.html: New. |
| | | * pthread_win32_attach_detach_np.html: New. |
| | | * pthread_win32_test_features_np.html: New. |
| | | * sched_get_priority_max.html: New. |
| | | * sched_getscheduler.html: New. |
| | | * sched_setscheduler.html: New. |
| | | * sched_yield.html: New. |
| | | * sem_init.html: New. |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PORTABILITYISSUES manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050506;11580000"> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <H4><A HREF="#toc">Table of Contents</A></H4> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">Portability issues</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>Thread priority</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <H3>Thread priority</H3> |
| | | <P STYLE="margin-left: 2cm">POSIX defines a single contiguous range |
| | | of numbers that determine a thread's priority. Win32 defines priority |
| | | classes - and priority levels relative to these classes. Classes are |
| | | simply priority base levels that the defined priority levels are |
| | | relative to such that, changing a process's priority class will |
| | | change the priority of all of it's threads, while the threads retain |
| | | the same relativity to each other.</P> |
| | | <P STYLE="margin-left: 2cm">A Win32 system defines a single |
| | | contiguous monotonic range of values that define system priority |
| | | levels, just like POSIX. However, Win32 restricts individual threads |
| | | to a subset of this range on a per-process basis.</P> |
| | | <P STYLE="margin-left: 2cm">The following table shows the base |
| | | priority levels for combinations of priority class and priority value |
| | | in Win32.</P> |
| | | <DL> |
| | | <DL> |
| | | <DD> |
| | | <TABLE WIDTH=742 BORDER=0 CELLPADDING=0 CELLSPACING=0 STYLE="page-break-inside: avoid"> |
| | | <COL WIDTH=50> |
| | | <COL WIDTH=356> |
| | | <COL WIDTH=336> |
| | | <THEAD> |
| | | <TR VALIGN=TOP> |
| | | <TD WIDTH=50> |
| | | <P ALIGN=CENTER><BR> |
| | | </P> |
| | | </TD> |
| | | <TD WIDTH=356> |
| | | <P ALIGN=LEFT><B>Process Priority Class</B></P> |
| | | </TD> |
| | | <TD WIDTH=336> |
| | | <P ALIGN=LEFT><B>Thread Priority Level</B></P> |
| | | </TD> |
| | | </TR> |
| | | </THEAD> |
| | | <TBODY> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="1" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>1</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="1" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>1</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="1" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>1</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="1" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>1</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="1" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>1</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="2" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>2</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="3" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>3</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="4" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>4</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="4" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>4</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="5" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>5</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="5" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>5</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="5" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>5</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Background NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="6" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>6</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="6" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>6</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="6" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>6</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Background NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="7" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>7</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="7" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>7</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Background NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="7" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>7</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Foreground NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="8" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>8</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="8" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>8</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="8" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>8</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Foreground NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="8" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>8</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="9" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>9</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="9" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>9</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Foreground NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="9" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>9</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="10" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>10</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Foreground NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="10" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>10</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="11" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>11</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>Foreground NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="11" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>11</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="11" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>11</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="12" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>12</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="12" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>12</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="13" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>13</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="14" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>14</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>HIGH_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>IDLE_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>BELOW_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="15" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>15</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>ABOVE_NORMAL_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="16" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>16</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_IDLE</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="17" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>17</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="-7" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>-7</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="18" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>18</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="-6" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>-6</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="19" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>19</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="-5" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>-5</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="20" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>20</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="-4" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>-4</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="21" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>21</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="-3" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>-3</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="22" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>22</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_LOWEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="23" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>23</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_BELOW_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="24" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>24</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="25" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>25</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_ABOVE_NORMAL</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="26" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>26</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_HIGHEST</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="27" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>27</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="3" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>3</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="28" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>28</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="4" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>4</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="29" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>29</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="5" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>5</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="30" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>30</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=BOTTOM SDVAL="6" SDNUM="3081;"> |
| | | <P ALIGN=LEFT>6</P> |
| | | </TD> |
| | | </TR> |
| | | <TR> |
| | | <TD WIDTH=50 VALIGN=BOTTOM SDVAL="31" SDNUM="3081;"> |
| | | <P ALIGN=CENTER>31</P> |
| | | </TD> |
| | | <TD WIDTH=356 VALIGN=TOP> |
| | | <P ALIGN=LEFT>REALTIME_PRIORITY_CLASS</P> |
| | | </TD> |
| | | <TD WIDTH=336 VALIGN=TOP> |
| | | <P ALIGN=LEFT>THREAD_PRIORITY_TIME_CRITICAL</P> |
| | | </TD> |
| | | </TR> |
| | | </TBODY> |
| | | </TABLE> |
| | | </DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm">Windows NT: Values -7, -6, -5, -4, -3, 3, |
| | | 4, 5, and 6 are not supported.</P> |
| | | <P STYLE="margin-left: 2cm">As you can see, the real priority levels |
| | | available to any individual Win32 thread are non-contiguous.</P> |
| | | <P STYLE="margin-left: 2cm">An application using Pthreads-w32 should |
| | | not make assumptions about the numbers used to represent thread |
| | | priority levels, except that they are monotonic between the values |
| | | returned by sched_get_priority_min() and sched_get_priority_max(). |
| | | E.g. Windows 95, 98, NT, 2000, XP make available a non-contiguous |
| | | range of numbers between -15 and 15, while at least one version of |
| | | WinCE (3.0) defines the minimum priority (THREAD_PRIORITY_LOWEST) as |
| | | 5, and the maximum priority (THREAD_PRIORITY_HIGHEST) as 1.</P> |
| | | <P STYLE="margin-left: 2cm">Internally, pthreads-win32 maps any |
| | | priority levels between THREAD_PRIORITY_IDLE and |
| | | THREAD_PRIORITY_LOWEST to THREAD_PRIORITY_LOWEST, or between |
| | | THREAD_PRIORITY_TIME_CRITICAL and THREAD_PRIORITY_HIGHEST to |
| | | THREAD_PRIORITY_HIGHEST. Currently, this also applies to |
| | | REALTIME_PRIORITY_CLASS even if levels -7, -6, -5, -4, -3, 3, 4, 5, |
| | | and 6 are supported.</P> |
| | | <P STYLE="margin-left: 2cm">If it wishes, a Win32 application using |
| | | pthreads-w32 can use the Win32 defined priority macros |
| | | THREAD_PRIORITY_IDLE through THREAD_PRIORITY_TIME_CRITICAL.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">See also</A></H2> |
| | | <P><BR><BR> |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect4" NAME="toc4">See also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE></TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;17350500"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20110326;18352700"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <STYLE TYPE="text/css"> |
| | | <!-- |
| | | H4.cjk { font-family: "AR PL UMing CN" } |
| | | H4.ctl { font-family: "Lohit Devanagari" } |
| | | H3.cjk { font-family: "AR PL UMing CN" } |
| | | H3.ctl { font-family: "Lohit Devanagari" } |
| | | H2.cjk { font-family: "AR PL UMing CN" } |
| | | H2.ctl { font-family: "Lohit Devanagari" } |
| | | --> |
| | | </STYLE> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" DIR="LTR"> |
| | | <H4 CLASS="western">POSIX Threads for Windows – REFERENCE - |
| | | <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <H3 CLASS="western">Table of Contents</H3> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="#sect1" NAME="toc1">POSIX |
| | | threads API reference</A><BR><A HREF="#sect2" NAME="toc2">Miscellaneous |
| | | POSIX thread safe routines provided by Pthreads-w32</A><BR><A HREF="#sect3" NAME="toc3">Non-portable |
| | | Pthreads-w32 routines</A><BR><A HREF="#sect4" NAME="toc4">Other</A></P> |
| | | <H2 CLASS="western"><A HREF="#toc1" NAME="sect1">POSIX threads API |
| | | reference</A></H2> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_getdetachstate</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_getinheritsched</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_getschedparam</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_getschedpolicy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_getscope</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_setstackaddr.html"><B>pthread_attr_getstackaddr</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_setstacksize.html"><B>pthread_attr_getstacksize</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_setdetachstate</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_setinheritsched</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_setschedparam</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_setschedpolicy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_init.html"><B>pthread_attr_setscope</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_setstackaddr.html"><B>pthread_attr_setstackaddr</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_attr_setstacksize.html"><B>pthread_attr_setstacksize</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrierattr_setpshared.html"><B>pthread_barrierattr_getpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrierattr_setpshared.html"><B>pthread_barrierattr_setpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrier_init.html"><B>pthread_barrier_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrier_init.html"><B>pthread_barrier_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cancel.html"><B>pthread_cancel</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_pop</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_push</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_condattr_init.html"><B>pthread_condattr_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_condattr_setpshared.html"><B>pthread_condattr_getpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_condattr_init.html"><B>pthread_condattr_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_condattr_setpshared.html"><B>pthread_condattr_setpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_broadcast</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_signal</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_timedwait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cond_init.html"><B>pthread_cond_wait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_create.html"><B>pthread_create</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_detach.html"><B>pthread_detach</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_equal.html"><B>pthread_equal</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_exit.html"><B>pthread_exit</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_setconcurrency.html"><B>pthread_getconcurrency</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_setschedparam.html"><B>pthread_getschedparam</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_getunique_np.html"><B>pthread_getunique_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_key_create.html"><B>pthread_getspecific</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_join.html"><B>pthread_join</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_key_create.html"><B>pthread_key_create</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_key_create.html"><B>pthread_key_delete</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_kill.html"><B>pthread_kill</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_getkind_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_setpshared.html"><B>pthread_mutexattr_getpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_getrobust</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_gettype</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_setkind_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_setpshared.html"><B>pthread_mutexattr_setpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_setrobust</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_settype</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_consistent</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_lock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_timedlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_trylock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_mutex_init.html"><B>pthread_mutex_unlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_once.html"><B>pthread_once</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlockattr_init.html"><B>pthread_rwlockattr_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlockattr_setpshared.html"><B>pthread_rwlockattr_getpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlockattr_init.html"><B>pthread_rwlockattr_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlockattr_setpshared.html"><B>pthread_rwlockattr_setpshared</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_self.html"><B>pthread_self</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cancel.html"><B>pthread_setcancelstate</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cancel.html"><B>pthread_setcanceltype</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_setconcurrency.html"><B>pthread_setconcurrency</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_setschedparam.html"><B>pthread_setschedparam</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_key_create.html"><B>pthread_setspecific</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_kill.html"><B>pthread_sigmask</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_spin_init.html"><B>pthread_spin_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_spin_init.html"><B>pthread_spin_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_spin_lock.html"><B>pthread_spin_trylock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_spin_unlock.html"><B>pthread_spin_unlock</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_cancel.html"><B>pthread_testcancel</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sched_get_priority_max.html"><B>sched_get_priority_max</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sched_get_priority_max.html"><B>sched_get_priority_min</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sched_getscheduler.html"><B>sched_getscheduler</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sched_setscheduler.html"><B>sched_setscheduler</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sched_yield.html"><B>sched_yield</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><B>sem_close</B></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_destroy</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_getvalue</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_init</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><B>sem_open</B></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_post</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_post_multiple</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_timedwait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_trywait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><B>sem_unlink</B></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="sem_init.html"><B>sem_wait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_kill.html"><B>sigwait</B></A></P> |
| | | <H2 CLASS="western"><A HREF="#toc3" NAME="sect3">Non-portable |
| | | Pthreads-w32 routines</A></H2> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthreadCancelableWait.html"><B>pthreadCancelableTimedWait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthreadCancelableWait.html"><B>pthreadCancelableWait</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_delay_np.html"><B>pthread_delay_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_getw32threadhandle_np.html"><B>pthread_getw32threadhandle_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_num_processors_np.html"><B>pthread_num_processors_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_win32_test_features_np.html"><B>pthread_win32_test_features_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_timechange_handler_np.html"><B>pthread_timechange_handler_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_win32_attach_detach_np.html"><B>pthread_win32_process_attach_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_win32_attach_detach_np.html"><B>pthread_win32_process_detach_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_win32_attach_detach_np.html"><B>pthread_win32_thread_attach_np</B></A></P> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="pthread_win32_attach_detach_np.html"><B>pthread_win32_thread_detach_np</B></A></P> |
| | | <H2 CLASS="western"><A HREF="#toc4" NAME="sect4">Other</A></H2> |
| | | <P STYLE="margin-left: 0.79in"><A HREF="PortabilityIssues.html"><B>Portability |
| | | issues</B></A></P> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREADCANCELLABLEWAIT manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;23242300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthreadCancelableTimedWait, |
| | | pthreadCancelableWait – provide cancellation hooks for user Win32 |
| | | routines</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthreadCancelableTimedWait (HANDLE </B><I>waitHandle</I><B>, |
| | | DWORD </B><I>timeout</I><B>);</B></P> |
| | | <P><B>int pthreadCancelableWait (HANDLE </B><I>waitHandle</I><B>);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>These two functions provide hooks into the <A HREF="pthread_cancel.html"><B>pthread_cancel</B></A>() |
| | | mechanism that will allow you to wait on a Windows handle and make it |
| | | a cancellation point. Both functions block until either the given |
| | | Win32 <B>HANDLE</B> is signalled, or <A HREF="pthread_cancel.html"><B>pthread_cancel</B></A>() |
| | | has been called. They are implemented using <B>WaitForMultipleObjects</B> |
| | | on <I>waitHandle</I> and the manually reset Win32 event handle that |
| | | is the target of <A HREF="pthread_cancel.html"><B>pthread_cancel</B></A>(). |
| | | These routines may be called from Win32 native threads but |
| | | <A HREF="pthread_cancel.html"><B>pthread_cancel</B></A>() will |
| | | require that thread's POSIX thread ID that the thread must retrieve |
| | | using <A HREF="pthread_self.html"><B>pthread_self</B></A>().</P> |
| | | <P><B>pthreadCancelableTimedWait</B> is the timed version that will |
| | | return with the code <B>ETIMEDOUT</B> if the interval <I>timeout</I> |
| | | milliseconds elapses before <I>waitHandle</I> is signalled.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>These routines allow routines that block on Win32 HANDLEs to be |
| | | cancellable via <A HREF="pthread_cancel.html"><B>pthread_cancel</B></A>().</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P><BR><BR> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>The <B>pthreadCancelableTimedWait</B> function returns the |
| | | following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ETIMEDOUT</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm"> |
| | | The interval <I>timeout</I> milliseconds elapsed before <I>waitHandle</I> |
| | | was signalled.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">See also</A></H2> |
| | | <P><A HREF="pthread_cancel.html"><B>pthread_cancel()</B></A>, |
| | | <A HREF="pthread_self.html"><B>pthread_self()</B></A></P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4"></A><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A><A HREF="#sect4" NAME="toc4"></A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect7" NAME="toc7">See also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_ATTR_INIT(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;10092900"> |
| | | <META NAME="CHANGED" CONTENT="20050505;16540200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_attr_init, pthread_attr_destroy, |
| | | pthread_attr_setdetachstate, pthread_attr_getdetachstate, |
| | | pthread_attr_setschedparam, pthread_attr_getschedparam, |
| | | pthread_attr_setschedpolicy, pthread_attr_getschedpolicy, |
| | | pthread_attr_setinheritsched, pthread_attr_getinheritsched, |
| | | pthread_attr_setscope, pthread_attr_getscope - thread creation |
| | | attributes |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_attr_init(pthread_attr_t *</B><I>attr</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_destroy(pthread_attr_t *</B><I>attr</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_setdetachstate(pthread_attr_t *</B><I>attr</I><B>, |
| | | int </B><I>detachstate</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_getdetachstate(const pthread_attr_t *</B><I>attr</I><B>, |
| | | int *</B><I>detachstate</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_setschedpolicy(pthread_attr_t *</B><I>attr</I><B>, |
| | | int </B><I>policy</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_getschedpolicy(const pthread_attr_t *</B><I>attr</I><B>, |
| | | int *</B><I>policy</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_setschedparam(pthread_attr_t *</B><I>attr</I><B>, |
| | | const struct sched_param *</B><I>param</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_getschedparam(const pthread_attr_t *</B><I>attr</I><B>, |
| | | struct sched_param *</B><I>param</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_setinheritsched(pthread_attr_t *</B><I>attr</I><B>, |
| | | int </B><I>inherit</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_getinheritsched(const pthread_attr_t *</B><I>attr</I><B>, |
| | | int *</B><I>inherit</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_setscope(pthread_attr_t *</B><I>attr</I><B>, |
| | | int </B><I>scope</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_attr_getscope(const pthread_attr_t *</B><I>attr</I><B>, |
| | | int *</B><I>scope</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Setting attributes for threads is achieved by filling a thread |
| | | attribute object <I>attr</I> of type <B>pthread_attr_t</B>, then |
| | | passing it as second argument to <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | . Passing <B>NULL</B> is equivalent to passing a thread attribute |
| | | object with all attributes set to their default values. |
| | | </P> |
| | | <P><B>pthread_attr_init</B> initializes the thread attribute object |
| | | <I>attr</I> and fills it with default values for the attributes. (The |
| | | default values are listed below for each attribute.) |
| | | </P> |
| | | <P>Each attribute <I>attrname</I> (see below for a list of all |
| | | attributes) can be individually set using the function |
| | | <B>pthread_attr_set</B><I>attrname</I> and retrieved using the |
| | | function <B>pthread_attr_get</B><I>attrname.</I> |
| | | </P> |
| | | <P><B>pthread_attr_destroy</B> destroys a thread attribute object, |
| | | which must not then be reused until it is reinitialized. |
| | | </P> |
| | | <P>Attribute objects are consulted only when creating a new thread. |
| | | The same attribute object can be used for creating several threads. |
| | | Modifying an attribute object after a call to <B>pthread_create</B> |
| | | does not change the attributes of the thread previously created. |
| | | </P> |
| | | <P>The following thread attributes are supported: |
| | | </P> |
| | | <H3><A HREF="#toc3" NAME="sect3">detachstate</A></H3> |
| | | <P>Control whether the thread is created in the joinable state (value |
| | | <B>PTHREAD_CREATE_JOINABLE</B>) or in the detached state ( |
| | | <B>PTHREAD_CREATE_DETACHED</B>). |
| | | </P> |
| | | <P>Default value: <B>PTHREAD_CREATE_JOINABLE</B>. |
| | | </P> |
| | | <P>In the joinable state, another thread can synchronize on the |
| | | thread termination and recover its termination code using |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> . When a |
| | | joinable thread terminates, some of the thread resources are kept |
| | | allocated, and released only when another thread performs |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> on that |
| | | thread. |
| | | </P> |
| | | <P>In the detached state, the thread's resources are released |
| | | immediately when it terminates. <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> |
| | | cannot be used to synchronize on the thread termination. |
| | | </P> |
| | | <P>A thread created in the joinable state can later be put in the |
| | | detached thread using <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> |
| | | . |
| | | </P> |
| | | <H3><A HREF="#toc4" NAME="sect4">schedpolicy</A></H3> |
| | | <P>Select the scheduling policy for the thread: one of <B>SCHED_OTHER</B> |
| | | (regular, non-real-time scheduling), <B>SCHED_RR</B> (real-time, |
| | | round-robin) or <B>SCHED_FIFO</B> (real-time, first-in first-out). |
| | | </P> |
| | | <P><B>Pthreads-w32</B> only supports <B>SCHED_OTHER</B> - attempting |
| | | to set one of the other policies will return an error ENOTSUP.</P> |
| | | <P>Default value: <B>SCHED_OTHER</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> only supports <B>SCHED_OTHER</B> - attempting |
| | | to set one of the other policies will return an error ENOTSUP.</P> |
| | | <P>The scheduling policy of a thread can be changed after creation |
| | | with <A HREF="pthread_setschedparam.html"><B>pthread_setschedparam</B>(3)</A> |
| | | . |
| | | </P> |
| | | <H3><A HREF="#toc5" NAME="sect5">schedparam</A></H3> |
| | | <P>Contain the scheduling parameters (essentially, the scheduling |
| | | priority) for the thread.</P> |
| | | <P><B>Pthreads-w32</B> supports the priority levels defined by the |
| | | Windows system it is running on. Under Windows, thread priorities are |
| | | relative to the process priority class, which must be set via the |
| | | Windows W32 API.</P> |
| | | <P>Default value: priority is 0 (Win32 level <B>THREAD_PRIORITY_NORMAL</B>). |
| | | </P> |
| | | <P>The scheduling priority of a thread can be changed after creation |
| | | with <A HREF="pthread_setschedparam.html"><B>pthread_setschedparam</B>(3)</A> |
| | | . |
| | | </P> |
| | | <H3><A HREF="#toc6" NAME="sect6">inheritsched</A></H3> |
| | | <P>Indicate whether the scheduling policy and scheduling parameters |
| | | for the newly created thread are determined by the values of the |
| | | <I>schedpolicy</I> and <I>schedparam</I> attributes (value |
| | | <B>PTHREAD_EXPLICIT_SCHED</B>) or are inherited from the parent |
| | | thread (value <B>PTHREAD_INHERIT_SCHED</B>). |
| | | </P> |
| | | <P>Default value: <B>PTHREAD_EXPLICIT_SCHED</B>. |
| | | </P> |
| | | <H3><A HREF="#toc7" NAME="sect7">scope</A></H3> |
| | | <P>Define the scheduling contention scope for the created thread. The |
| | | only value supported in the <B>Pthreads-w32</B> implementation is |
| | | <B>PTHREAD_SCOPE_SYSTEM</B>, meaning that the threads contend for CPU |
| | | time with all processes running on the machine. The other value |
| | | specified by the standard, <B>PTHREAD_SCOPE_PROCESS</B>, means that |
| | | scheduling contention occurs only between the threads of the running |
| | | process.</P> |
| | | <P><B>Pthreads-w32</B> only supports <B>PTHREAD_SCOPE_SYSTEM</B>.</P> |
| | | <P>Default value: <B>PTHREAD_SCOPE_SYSTEM</B>. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Return Value</A></H2> |
| | | <P>All functions return 0 on success and a non-zero error code on |
| | | error. On success, the <B>pthread_attr_get</B><I>attrname</I> |
| | | functions also store the current value of the attribute <I>attrname</I> |
| | | in the location pointed to by their second argument. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">Errors</A></H2> |
| | | <P>The <B>pthread_attr_setdetachstate</B> function returns the |
| | | following error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the specified <I>detachstate</I> is not one of |
| | | <B>PTHREAD_CREATE_JOINABLE</B> or <B>PTHREAD_CREATE_DETACHED</B>. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_attr_setschedparam</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the priority specified in <I>param</I> is outside the range of |
| | | allowed priorities for the scheduling policy currently in <I>attr</I> |
| | | (1 to 99 for <B>SCHED_FIFO</B> and <B>SCHED_RR</B>; 0 for |
| | | <B>SCHED_OTHER</B>). |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_attr_setschedpolicy</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the specified <I>policy</I> is not one of <B>SCHED_OTHER</B>, |
| | | <B>SCHED_FIFO</B>, or <B>SCHED_RR</B>. |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOTSUP</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>policy</I> is not <B>SCHED_OTHER</B>, the only value supported |
| | | by <B>Pthreads-w32</B>.</DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_attr_setinheritsched</B> function returns the |
| | | following error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the specified <I>inherit</I> is not one of <B>PTHREAD_INHERIT_SCHED</B> |
| | | or <B>PTHREAD_EXPLICIT_SCHED</B>. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_attr_setscope</B> function returns the following error |
| | | codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the specified <I>scope</I> is not one of <B>PTHREAD_SCOPE_SYSTEM</B> |
| | | or <B>PTHREAD_SCOPE_PROCESS</B>. |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOTSUP</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the specified <I>scope</I> is <B>PTHREAD_SCOPE_PROCESS</B> (not |
| | | supported by <B>Pthreads-w32</B>). |
| | | </DD></DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc10" NAME="sect10">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc11" NAME="sect11">See Also</A></H2> |
| | | <P><A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> , |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> , |
| | | <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> , |
| | | <A HREF="pthread_setschedparam.html"><B>pthread_setschedparam</B>(3)</A> |
| | | . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">detachstate</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">schedpolicy</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">schedparam</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">inheritsched</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">scope</A> |
| | | </P> |
| | | </UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect10" NAME="toc10">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect11" NAME="toc11">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_ATTR_GETSTACKADDR"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11025500"> |
| | | <META NAME="CHANGED" CONTENT="20050505;17571400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_attr_getstackaddr, pthread_attr_setstackaddr - get and set |
| | | the stackaddr attribute |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_attr_getstackaddr(const pthread_attr_t *restrict</B> |
| | | <I>attr</I><B>, void **restrict</B> <I>stackaddr</I><B>); <BR>int |
| | | pthread_attr_setstackaddr(pthread_attr_t *</B><I>attr</I><B>, void |
| | | *</B><I>stackaddr</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_attr_getstackaddr</B> and <B>pthread_attr_setstackaddr</B> |
| | | functions, respectively, shall get and set the thread creation |
| | | <I>stackaddr</I> attribute in the <I>attr</I> object. |
| | | </P> |
| | | <P>The <I>stackaddr</I> attribute specifies the location of storage |
| | | to be used for the created thread’s stack. The size of the storage |
| | | shall be at least {PTHREAD_STACK_MIN}. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_ATTR_STACKADDR</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented but |
| | | cannot used to set or get the stack address. These routines always |
| | | return the error ENOSYS when called.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, <B>pthread_attr_getstackaddr</B> and |
| | | <B>pthread_attr_setstackaddr</B> shall return a value of 0; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <P>The <B>pthread_attr_getstackaddr</B> function stores the <I>stackaddr</I> |
| | | attribute value in <I>stackaddr</I> if successful. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_attr_setstackaddr</B> function always returns the |
| | | following error code: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOSYS</B></DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The function is not supported. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_attr_getstackaddr</B> function always returns the |
| | | following error code: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOSYS</B></DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The function is not supported. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>The specification of the <I>stackaddr</I> attribute presents |
| | | several ambiguities that make portable use of these interfaces |
| | | impossible. The description of the single address parameter as a |
| | | "stack" does not specify a particular relationship between |
| | | the address and the "stack" implied by that address. For |
| | | example, the address may be taken as the low memory address of a |
| | | buffer intended for use as a stack, or it may be taken as the address |
| | | to be used as the initial stack pointer register value for the new |
| | | thread. These two are not the same except for a machine on which the |
| | | stack grows "up" from low memory to high, and on which a |
| | | "push" operation first stores the value in memory and then |
| | | increments the stack pointer register. Further, on a machine where |
| | | the stack grows "down" from high memory to low, |
| | | interpretation of the address as the "low memory" address |
| | | requires a determination of the intended size of the stack. |
| | | IEEE Std 1003.1-2001 has introduced the new interfaces |
| | | <A HREF="pthread_attr_setstack.html"><B>pthread_attr_setstack</B>(3)</A> |
| | | and <A HREF="pthread_attr_getstack.html"><B>pthread_attr_getstack</B>(3)</A> |
| | | to resolve these ambiguities. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_attr_init.html"><B>pthread_attr_destroy</B>(3)</A> |
| | | , <A HREF="pthread_attr_init.html"><B>pthread_attr_getdetachstate</B>(3)</A> |
| | | , <A HREF="pthread_attr_getstack.html"><B>pthread_attr_getstack</B>(3)</A> |
| | | , <A HREF="pthread_attr_getstacksize.html"><B>pthread_attr_getstacksize</B>(3)</A> |
| | | , <A HREF="pthread_attr_setstack.html"><B>pthread_attr_setstack</B>(3)</A> |
| | | , <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> , the |
| | | Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><limits.h></I>, <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_ATTR_GETSTACKSIZE"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11224900"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18003200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_attr_getstacksize, pthread_attr_setstacksize - get and set |
| | | the stacksize attribute |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_attr_getstacksize(const pthread_attr_t *restrict</B> |
| | | <I>attr</I><B>, size_t *restrict</B> <I>stacksize</I><B>); <BR>int |
| | | pthread_attr_setstacksize(pthread_attr_t *</B><I>attr</I><B>, size_t</B> |
| | | <I>stacksize</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_attr_getstacksize</B> and <B>pthread_attr_setstacksize</B> |
| | | functions, respectively, shall get and set the thread creation |
| | | <I>stacksize</I> attribute in the <I>attr</I> object. |
| | | </P> |
| | | <P>The <I>stacksize</I> attribute shall define the minimum stack size |
| | | (in bytes) allocated for the created threads stack. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_ATTR_STACKSIZE</B> in |
| | | pthread.h to indicate that these routines are implemented and may be |
| | | used to set or get the stack size.</P> |
| | | <P>Default value: 0 (in Pthreads-w32 a value of 0 means the stack |
| | | will grow as required)</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, <B>pthread_attr_getstacksize</B> and |
| | | <B>pthread_attr_setstacksize</B> shall return a value of 0; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <P>The <B>pthread_attr_getstacksize</B> function stores the <I>stacksize</I> |
| | | attribute value in <I>stacksize</I> if successful. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_attr_setstacksize</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value of <I>stacksize</I> is less than {PTHREAD_STACK_MIN} or |
| | | exceeds a system-imposed limit. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_attr_init.html"><B>pthread_attr_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_attr_setstackaddr.html"><B>pthread_attr_getstackaddr</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_attr_init.html"><B>pthread_attr_getdetachstate</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> <B>,</B> |
| | | the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><limits.h></I>, <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_BARRIER_DESTROY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11372800"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20060408;9450100"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_barrier_destroy, pthread_barrier_init - destroy and |
| | | initialize a barrier object (<B>ADVANCED REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_barrier_destroy(pthread_barrier_t *</B><I>barrier</I><B>); |
| | | <BR>int pthread_barrier_init(pthread_barrier_t *restrict</B> <I>barrier</I><B>, |
| | | const pthread_barrierattr_t *restrict</B> <I>attr</I><B>, unsigned</B> |
| | | <I>count</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_barrier_destroy</B> function shall destroy the |
| | | barrier referenced by <I>barrier</I> and release any resources used |
| | | by the barrier. The effect of subsequent use of the barrier is |
| | | undefined until the barrier is reinitialized by another call to |
| | | <B>pthread_barrier_init</B> . An implementation may use this function |
| | | to set <I>barrier</I> to an invalid value. An error code is returned if <B>pthread_barrier_destroy</B> is called when any thread is |
| | | blocked on the barrier, or if this function is called with an |
| | | uninitialized barrier. |
| | | </P> |
| | | <P>The <B>pthread_barrier_init</B> function shall allocate any |
| | | resources required to use the barrier referenced by <I>barrier</I> |
| | | and shall initialize the barrier with attributes referenced by <I>attr</I>. |
| | | If <I>attr</I> is NULL, the default barrier attributes shall be used; |
| | | the effect is the same as passing the address of a default barrier |
| | | attributes object. The results are undefined if <B>pthread_barrier_init</B> |
| | | is called when any thread is blocked on the barrier (that is, has not |
| | | returned from the <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | call). The results are undefined if a barrier is used without first |
| | | being initialized. The results are undefined if <B>pthread_barrier_init</B> |
| | | is called specifying an already initialized barrier. |
| | | </P> |
| | | <P>The <I>count</I> argument specifies the number of threads that |
| | | must call <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | before any of them successfully return from the call. The value |
| | | specified by <I>count</I> must be greater than zero. |
| | | </P> |
| | | <P>If the <B>pthread_barrier_init</B> function fails, the barrier |
| | | shall not be initialized and the contents of <I>barrier</I> are |
| | | undefined. |
| | | </P> |
| | | <P>Only the object referenced by <I>barrier</I> may be used for |
| | | performing synchronization. The result of referring to copies of that |
| | | object in calls to <B>pthread_barrier_destroy</B> <B>or</B> |
| | | <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | is undefined.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, these functions shall return zero; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_barrier_destroy</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD> |
| | | The implementation has detected an attempt to destroy a barrier |
| | | while it is in use (for example, while being used in a |
| | | <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | call) by another thread. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>barrier</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_barrier_init</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EAGAIN</B> |
| | | </DT><DD> |
| | | The system lacks the necessary resources to initialize another |
| | | barrier. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD> |
| | | The value specified by <I>count</I> is equal to zero. |
| | | </DD><DT> |
| | | <B>ENOMEM</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | Insufficient memory exists to initialize the barrier. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_barrier_init</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD> |
| | | The implementation has detected an attempt to reinitialize a barrier |
| | | while it is in use (for example, while being used in a |
| | | <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | call) by another thread. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>The <B>pthread_barrier_destroy</B> and <B>pthread_barrier_init</B> |
| | | functions are part of the Barriers option and need not be provided on |
| | | all implementations. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> to indicate |
| | | that these routines are implemented and may be used.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc11" NAME="sect11">Known Bugs</A></H2> |
| | | <DL> |
| | | <DD STYLE="margin-left: 0cm; margin-bottom: 0.5cm">In |
| | | <B><SPAN LANG="en-GB"><SPAN LANG="en-GB">pthreads-win32</SPAN></SPAN></B>, |
| | | the behaviour of threads which enter <A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | while the barrier is being destroyed is undefined. |
| | | </DD></DL> |
| | | <H2> |
| | | <A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_barrier_wait.html"><B>pthread_barrier_wait</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect11" NAME="toc11">Known |
| | | Bugs</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_BARRIER_WAIT"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11484200"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20060408;9504600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_barrier_wait - synchronize at a barrier (<B>ADVANCED |
| | | REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_barrier_wait(pthread_barrier_t *</B><I>barrier</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_barrier_wait</B> function shall synchronize |
| | | participating threads at the barrier referenced by <I>barrier</I>. |
| | | The calling thread shall block until the required number of threads |
| | | have called <B>pthread_barrier_wait</B> specifying the barrier. |
| | | </P> |
| | | <P>When the required number of threads have called |
| | | <B>pthread_barrier_wait</B> specifying the barrier, the constant |
| | | <B>PTHREAD_BARRIER_SERIAL_THREAD</B> shall be returned to one |
| | | unspecified thread and zero shall be returned to each of the |
| | | remaining threads. At this point, the barrier shall be reset to the |
| | | state it had as a result of the most recent <A HREF="pthread_barrier_init.html"><B>pthread_barrier_init</B>(3)</A> |
| | | function that referenced it. |
| | | </P> |
| | | <P>The constant <B>PTHREAD_BARRIER_SERIAL_THREAD</B> is defined in |
| | | <I><pthread.h></I> and its value shall be distinct from any |
| | | other value returned by <B>pthread_barrier_wait</B> . |
| | | </P> |
| | | <P>The results are undefined if this function is called with an |
| | | uninitialized barrier. |
| | | </P> |
| | | <P>If a signal is delivered to a thread blocked on a barrier, upon |
| | | return from the signal handler the thread shall resume waiting at the |
| | | barrier if the barrier wait has not completed (that is, if the |
| | | required number of threads have not arrived at the barrier during the |
| | | execution of the signal handler); otherwise, the thread shall |
| | | continue as normal from the completed barrier wait. Until the thread |
| | | in the signal handler returns from it, it is unspecified whether |
| | | other threads may proceed past the barrier once they have all reached |
| | | it. |
| | | </P> |
| | | <P>A thread that has blocked on a barrier shall not prevent any |
| | | unblocked thread that is eligible to use the same processing |
| | | resources from eventually making forward progress in its execution. |
| | | Eligibility for processing resources shall be determined by the |
| | | scheduling policy. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, the <B>pthread_barrier_wait</B> |
| | | function shall return <B>PTHREAD_BARRIER_SERIAL_THREAD</B> for a |
| | | single (arbitrary) thread synchronized at the barrier and zero for |
| | | each of the other threads. Otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_barrier_wait</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>barrier</I> does not refer to an |
| | | initialized barrier object. |
| | | </DD></DL> |
| | | <P> |
| | | This function shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using this function may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <P>The <B>pthread_barrier_wait</B> function is part of the Barriers |
| | | option and need not be provided on all implementations. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> to indicate |
| | | that this routine is implemented and may be used.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc11" NAME="sect11">Known Bugs</A></H2> |
| | | <DL> |
| | | None.</DL> |
| | | <H2> |
| | | <A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_barrier_init.html"><B>pthread_barrier_destroy</B>(3)</A>, |
| | | <A HREF="pthread_barrier_init.html"><B>pthread_barrier_init(3)</B></A>, |
| | | the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect11" NAME="toc11">Known |
| | | Bugs</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_BARRIERATTR_DESTROY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11502600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18032300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_barrierattr_destroy, pthread_barrierattr_init - destroy |
| | | and initialize the barrier attributes object (<B>ADVANCED REALTIME |
| | | THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P>i<B>nt pthread_barrierattr_destroy(pthread_barrierattr_t *</B><I>attr</I><B>); |
| | | <BR>int pthread_barrierattr_init(pthread_barrierattr_t *</B><I>attr</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_barrierattr_destroy</B> function shall destroy a |
| | | barrier attributes object. A destroyed <I>attr</I> attributes object |
| | | can be reinitialized using <B>pthread_barrierattr_init</B> ; the |
| | | results of otherwise referencing the object after it has been |
| | | destroyed are undefined. An implementation may cause |
| | | <B>pthread_barrierattr_destroy</B> to set the object referenced by |
| | | <I>attr</I> to an invalid value. |
| | | </P> |
| | | <P>The <B>pthread_barrierattr_init</B> function shall initialize a |
| | | barrier attributes object <I>attr</I> with the default value for all |
| | | of the attributes defined by the implementation. |
| | | </P> |
| | | <P>Results are undefined if <B>pthread_barrierattr_init</B> is called |
| | | specifying an already initialized <I>attr</I> attributes object. |
| | | </P> |
| | | <P>After a barrier attributes object has been used to initialize one |
| | | or more barriers, any function affecting the attributes object |
| | | (including destruction) shall not affect any previously initialized |
| | | barrier. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_barrierattr_destroy</B> and |
| | | <B>pthread_barrierattr_init</B> functions shall return zero; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_barrierattr_destroy</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_barrierattr_init</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>ENOMEM</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | Insufficient memory exists to initialize the barrier attributes |
| | | object. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>The <B>pthread_barrierattr_destroy</B> and |
| | | <B>pthread_barrierattr_init</B> functions are part of the Barriers |
| | | option and need not be provided on all implementations. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> to indicate |
| | | that these routines are implemented and may be used.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_barrierattr_setpshared.html"><B>pthread_barrierattr_getpshared</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_barrierattr_setpshared.html"><B>pthread_barrierattr_setpshared</B>(3)</A> |
| | | , the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I>. |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_BARRIERATTR_GETPSHARED"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;11552100"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18080400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_barrierattr_getpshared, pthread_barrierattr_setpshared - |
| | | get and set the process-shared attribute of the barrier attributes |
| | | object (<B>ADVANCED REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_barrierattr_getpshared(const pthread_barrierattr_t |
| | | * restrict</B> <I>attr</I><B>, int *restrict</B> <I>pshared</I><B>); |
| | | <BR>int pthread_barrierattr_setpshared(pthread_barrierattr_t *</B><I>attr</I><B>, |
| | | int</B> <I>pshared</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_barrierattr_getpshared</B> function shall obtain |
| | | the value of the <I>process-shared</I> attribute from the attributes |
| | | object referenced by <I>attr</I>. The <B>pthread_barrierattr_setpshared</B> |
| | | function shall set the <I>process-shared</I> attribute in an |
| | | initialized attributes object referenced by <I>attr</I>. |
| | | </P> |
| | | <P>The <I>process-shared</I> attribute is set to |
| | | PTHREAD_PROCESS_SHARED to permit a barrier to be operated upon by any |
| | | thread that has access to the memory where the barrier is allocated. |
| | | If the <I>process-shared</I> attribute is PTHREAD_PROCESS_PRIVATE, |
| | | the barrier shall only be operated upon by threads created within the |
| | | same process as the thread that initialized the barrier; if threads |
| | | of different processes attempt to operate on such a barrier, the |
| | | behavior is undefined. The default value of the attribute shall be |
| | | PTHREAD_PROCESS_PRIVATE. Both constants PTHREAD_PROCESS_SHARED and |
| | | PTHREAD_PROCESS_PRIVATE are defined in <I><pthread.h></I>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines _<B>POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented but |
| | | that the process shared attribute is not supported.</P> |
| | | <P>Additional attributes, their default values, and the names of the |
| | | associated functions to get and set those attribute values are |
| | | implementation-defined. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_barrierattr_getpshared</B> function |
| | | shall return zero and store the value of the <I>process-shared</I> |
| | | attribute of <I>attr</I> into the object referenced by the <I>pshared</I> |
| | | parameter. Otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <P>If successful, the <B>pthread_barrierattr_setpshared</B> function |
| | | shall return zero; otherwise, an error number shall be returned to |
| | | indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>These functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD><DT> |
| | | The <B>pthread_barrierattr_setpshared</B> function may fail if: |
| | | </DT><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the <I>process-shared</I> attribute is |
| | | not one of the legal values <B>PTHREAD_PROCESS_SHARED</B> or |
| | | <B>PTHREAD_PROCESS_PRIVATE</B>. |
| | | </DD><DT> |
| | | <B>ENOSYS</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> was <B>PTHREAD_PROCESS_SHARED</B> |
| | | (Pthreads-w32).</DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>The <B>pthread_barrierattr_getpshared</B> and |
| | | <B>pthread_barrierattr_setpshared</B> functions are part of the |
| | | Barriers option and need not be provided on all implementations. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_BARRIERS</B> and |
| | | <B>_POSIX_THREAD_PROCESS_SHARED</B> in pthread.h as -1 to indicate |
| | | that these routines are implemented and may be used, but do not |
| | | support the process shared option.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_barrier_init.html"><B>pthread_barrier_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_barrierattr_init.html"><B>pthread_barrierattr_init</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CANCEL(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;12090500"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18220000"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, |
| | | pthread_testcancel - thread cancellation |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_cancel(pthread_t </B><I>thread</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcancelstate(int </B><I>state</I><B>, int |
| | | *</B><I>oldstate</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcanceltype(int </B><I>type</I><B>, int |
| | | *</B><I>oldtype</I><B>);</B> |
| | | </P> |
| | | <P><B>void pthread_testcancel(void);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Cancellation is the mechanism by which a thread can terminate the |
| | | execution of another thread. More precisely, a thread can send a |
| | | cancellation request to another thread. Depending on its settings, |
| | | the target thread can then either ignore the request, honor it |
| | | immediately, or defer it until it reaches a cancellation point. |
| | | </P> |
| | | <P>When a thread eventually honors a cancellation request, it |
| | | performs as if <B>pthread_exit(PTHREAD_CANCELED)</B> has been called |
| | | at that point: all cleanup handlers are executed in reverse order, |
| | | destructor functions for thread-specific data are called, and finally |
| | | the thread stops executing with the return value <B>PTHREAD_CANCELED</B>. |
| | | See <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> for more |
| | | information. |
| | | </P> |
| | | <P><B>pthread_cancel</B> sends a cancellation request to the thread |
| | | denoted by the <I>thread</I> argument. |
| | | </P> |
| | | <P><B>pthread_setcancelstate</B> changes the cancellation state for |
| | | the calling thread -- that is, whether cancellation requests are |
| | | ignored or not. The <I>state</I> argument is the new cancellation |
| | | state: either <B>PTHREAD_CANCEL_ENABLE</B> to enable cancellation, or |
| | | <B>PTHREAD_CANCEL_DISABLE</B> to disable cancellation (cancellation |
| | | requests are ignored). If <I>oldstate</I> is not <B>NULL</B>, the |
| | | previous cancellation state is stored in the location pointed to by |
| | | <I>oldstate</I>, and can thus be restored later by another call to |
| | | <B>pthread_setcancelstate</B>. |
| | | </P> |
| | | <P><B>pthread_setcanceltype</B> changes the type of responses to |
| | | cancellation requests for the calling thread: asynchronous |
| | | (immediate) or deferred. The <I>type</I> argument is the new |
| | | cancellation type: either <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> to |
| | | cancel the calling thread as soon as the cancellation request is |
| | | received, or <B>PTHREAD_CANCEL_DEFERRED</B> to keep the cancellation |
| | | request pending until the next cancellation point. If <I>oldtype</I> |
| | | is not <B>NULL</B>, the previous cancellation state is stored in the |
| | | location pointed to by <I>oldtype</I>, and can thus be restored later |
| | | by another call to <B>pthread_setcanceltype</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> provides two levels of support for |
| | | <B>PTHREAD_CANCEL_ASYNCHRONOUS</B>: full and partial. Full support |
| | | requires an additional DLL and driver be installed on the Windows |
| | | system (see the See Also section below) that allows blocked threads |
| | | to be cancelled immediately. Partial support means that the target |
| | | thread will not cancel until it resumes execution naturally. Partial |
| | | support is provided if either the DLL or the driver are not |
| | | automatically detected by the pthreads-w32 library at run-time.</P> |
| | | <P>Threads are always created by <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | with cancellation enabled and deferred. That is, the initial |
| | | cancellation state is <B>PTHREAD_CANCEL_ENABLE</B> and the initial |
| | | type is <B>PTHREAD_CANCEL_DEFERRED</B>. |
| | | </P> |
| | | <P>Cancellation points are those points in the program execution |
| | | where a test for pending cancellation requests is performed and |
| | | cancellation is executed if positive. The following POSIX threads |
| | | functions are cancellation points: |
| | | </P> |
| | | <P><A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_init.html"><B>pthread_cond_wait</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_init.html"><B>pthread_cond_timedwait</B>(3)</A> |
| | | <BR><A HREF=""><B>pthread_testcancel</B>(3)</A> <BR><A HREF="sem_init.html"><B>sem_wait</B>(3)</A> |
| | | <BR><A HREF="sem_init.html"><B>sem_timedwait</B>(3)</A> <BR><A HREF="pthread_kill.html"><B>sigwait</B>(3)</A></P> |
| | | <P><B>Pthreads-w32</B> provides two functions to enable additional |
| | | cancellation points to be created in user functions that block on |
| | | Win32 HANDLEs:</P> |
| | | <P><A HREF="pthreadCancelableWait.html">pthreadCancelableWait()</A> |
| | | <BR><A HREF="pthreadCancelableTimedWait.html">pthreadCancelableTimedWait()</A></P> |
| | | <P>All other POSIX threads functions are guaranteed not to be |
| | | cancellation points. That is, they never perform cancellation in |
| | | deferred cancellation mode. |
| | | </P> |
| | | <P><B>pthread_testcancel</B> does nothing except testing for pending |
| | | cancellation and executing it. Its purpose is to introduce explicit |
| | | checks for cancellation in long sequences of code that do not call |
| | | cancellation point functions otherwise. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P><B>pthread_cancel</B>, <B>pthread_setcancelstate</B> and |
| | | <B>pthread_setcanceltype</B> return 0 on success and a non-zero error |
| | | code on error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P><B>pthread_cancel</B> returns the following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | no thread could be found corresponding to that specified by the |
| | | <I>thread</I> ID. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | <B>pthread_setcancelstate</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>state</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_ENABLE</B> nor <B>PTHREAD_CANCEL_DISABLE</B> |
| | | </BLOCKQUOTE> |
| | | <P><B>pthread_setcanceltype</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>type</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_DEFERRED</B> nor <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> |
| | | </BLOCKQUOTE> |
| | | <H2><A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , |
| | | <A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_push</B>(3)</A> |
| | | , <A HREF="pthread_cleanup_pop.html"><B>pthread_cleanup_pop</B>(3)</A> |
| | | , Pthreads-w32 package README file 'Prerequisites' section. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Bugs</A></H2> |
| | | <P>POSIX specifies that a number of system calls (basically, all |
| | | system calls that may block, such as <A HREF="read.html"><B>read</B>(2)</A> |
| | | , <A HREF="write.html"><B>write</B>(2)</A> , <A HREF="wait.html"><B>wait</B>(2)</A> |
| | | , etc.) and library functions that may call these system calls (e.g. |
| | | <A HREF="fprintf.html"><B>fprintf</B>(3)</A> ) are cancellation |
| | | points. <B>Pthreads-win32</B> is not integrated enough with the C |
| | | library to implement this, and thus none of the C library functions |
| | | is a cancellation point. |
| | | </P> |
| | | <P>A workaround for these calls is to temporarily switch to |
| | | asynchronous cancellation (assuming full asynchronous cancellation |
| | | support is installed). So, checking for cancellation during a <B>read</B> |
| | | system call, for instance, can be achieved as follows: |
| | | </P> |
| | | <BLOCKQUOTE><BR><BR> |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1cm; margin-right: 1cm">pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldCancelType); |
| | | read(fd, buffer, length); |
| | | pthread_setcanceltype(oldCancelType, NULL);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE><A NAME="toc"></A><B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE><A HREF="#sect7" NAME="toc7">Bugs</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CLEANUP(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;20152200"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18252600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_cleanup_push, pthread_cleanup_pop - install and remove |
| | | cleanup handlers |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>void pthread_cleanup_push(void (*</B><I>routine</I><B>) (void |
| | | *), void *</B><I>arg</I><B>);</B> |
| | | </P> |
| | | <P><B>void pthread_cleanup_pop(int </B><I>execute</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Cleanup handlers are functions that get called when a thread |
| | | terminates, either by calling <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> |
| | | or because of cancellation. Cleanup handlers are installed and |
| | | removed following a stack-like discipline. |
| | | </P> |
| | | <P>The purpose of cleanup handlers is to free the resources that a |
| | | thread may hold at the time it terminates. In particular, if a thread |
| | | exits or is cancelled while it owns a locked mutex, the mutex will |
| | | remain locked forever and prevent other threads from executing |
| | | normally. The best way to avoid this is, just before locking the |
| | | mutex, to install a cleanup handler whose effect is to unlock the |
| | | mutex. Cleanup handlers can be used similarly to free blocks |
| | | allocated with <A HREF="malloc.html"><B>malloc</B>(3)</A> or close |
| | | file descriptors on thread termination. |
| | | </P> |
| | | <P><B>pthread_cleanup_push</B> installs the <I>routine</I> function |
| | | with argument <I>arg</I> as a cleanup handler. From this point on to |
| | | the matching <B>pthread_cleanup_pop</B>, the function <I>routine</I> |
| | | will be called with arguments <I>arg</I> when the thread terminates, |
| | | either through <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> |
| | | or by cancellation. If several cleanup handlers are active at that |
| | | point, they are called in LIFO order: the most recently installed |
| | | handler is called first. |
| | | </P> |
| | | <P><B>pthread_cleanup_pop</B> removes the most recently installed |
| | | cleanup handler. If the <I>execute</I> argument is not 0, it also |
| | | executes the handler, by calling the <I>routine</I> function with |
| | | arguments <I>arg</I>. If the <I>execute</I> argument is 0, the |
| | | handler is only removed but not executed. |
| | | </P> |
| | | <P>Matching pairs of <B>pthread_cleanup_push</B> and |
| | | <B>pthread_cleanup_pop</B> must occur in the same function, at the |
| | | same level of block nesting. Actually, <B>pthread_cleanup_push</B> |
| | | and <B>pthread_cleanup_pop</B> are macros, and the expansion of |
| | | <B>pthread_cleanup_push</B> introduces an open brace <B>{</B> with |
| | | the matching closing brace <B>}</B> being introduced by the expansion |
| | | of the matching <B>pthread_cleanup_pop</B>. |
| | | </P> |
| | | <H2 STYLE="margin-top: 0cm"><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">None. |
| | | </BLOCKQUOTE> |
| | | <H2 STYLE="margin-top: 0cm"><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">None. |
| | | </BLOCKQUOTE> |
| | | <H2 STYLE="margin-top: 0cm"><A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">Xavier Leroy |
| | | <Xavier.Leroy@inria.fr> |
| | | </BLOCKQUOTE> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">Modified by |
| | | Ross Johnson for use with Pthreads-w32.</BLOCKQUOTE> |
| | | <H2 STYLE="margin-top: 0cm"><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> |
| | | , <A HREF="pthread_cancel.html"><B>pthread_cancel</B>(3)</A> , |
| | | <A HREF="pthread_cancel.html"><B>pthread_setcanceltype</B>(3)</A> . |
| | | </BLOCKQUOTE> |
| | | <H2 STYLE="margin-top: 0cm"><A HREF="#toc7" NAME="sect7">Example</A></H2> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">Here is how |
| | | to lock a mutex <I>mut</I> in such a way that it will be unlocked if |
| | | the thread is canceled while <I>mut</I> is locked: |
| | | </BLOCKQUOTE> |
| | | <PRE>pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); |
| | | pthread_mutex_lock(&mut); |
| | | /* do some work */ |
| | | pthread_mutex_unlock(&mut); |
| | | pthread_cleanup_pop(0);</PRE><BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"> |
| | | Equivalently, the last two lines can be replaced by |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-bottom: 0.5cm">pthread_cleanup_pop(1);</PRE><BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"> |
| | | Notice that the code above is safe only in deferred cancellation mode |
| | | (see <A HREF="pthread_cancel.html"><B>pthread_setcanceltype</B>(3)</A> |
| | | ). In asynchronous cancellation mode, a cancellation can occur |
| | | between <B>pthread_cleanup_push</B> and <B>pthread_mutex_lock</B>, or |
| | | between <B>pthread_mutex_unlock</B> and <B>pthread_cleanup_pop</B>, |
| | | resulting in both cases in the thread trying to unlock a mutex not |
| | | locked by the current thread. This is the main reason why |
| | | asynchronous cancellation is difficult to use. |
| | | </BLOCKQUOTE> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm">If the code |
| | | above must also work in asynchronous cancellation mode, then it must |
| | | switch to deferred mode for locking and unlocking the mutex: |
| | | </BLOCKQUOTE> |
| | | <PRE>pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); |
| | | pthread_cleanup_push(pthread_mutex_unlock, (void *) &mut); |
| | | pthread_mutex_lock(&mut); |
| | | /* do some work */ |
| | | pthread_cleanup_pop(1); |
| | | pthread_setcanceltype(oldtype, NULL);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"><A NAME="toc"></A> |
| | | <B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm"><A HREF="#sect7" NAME="toc7">Example</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_COND(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;16454400"> |
| | | <META NAME="CHANGED" CONTENT="20050505;19004700"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_cond_init, pthread_cond_destroy, pthread_cond_signal, |
| | | pthread_cond_broadcast, pthread_cond_wait, pthread_cond_timedwait - |
| | | operations on conditions |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>pthread_cond_t </B><I>cond</I> <B>= PTHREAD_COND_INITIALIZER;</B> |
| | | </P> |
| | | <P><B>int pthread_cond_init(pthread_cond_t *</B><I>cond</I><B>, |
| | | pthread_condattr_t *</B><I>cond_attr</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_cond_signal(pthread_cond_t *</B><I>cond</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_cond_broadcast(pthread_cond_t *</B><I>cond</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_cond_wait(pthread_cond_t *</B><I>cond</I><B>, |
| | | pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_cond_timedwait(pthread_cond_t *</B><I>cond</I><B>, |
| | | pthread_mutex_t *</B><I>mutex</I><B>, const struct timespec |
| | | *</B><I>abstime</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_cond_destroy(pthread_cond_t *</B><I>cond</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>A condition (short for ‘‘condition variable’’) is a |
| | | synchronization device that allows threads to suspend execution and |
| | | relinquish the processors until some predicate on shared data is |
| | | satisfied. The basic operations on conditions are: signal the |
| | | condition (when the predicate becomes true), and wait for the |
| | | condition, suspending the thread execution until another thread |
| | | signals the condition. |
| | | </P> |
| | | <P>A condition variable must always be associated with a mutex, to |
| | | avoid the race condition where a thread prepares to wait on a |
| | | condition variable and another thread signals the condition just |
| | | before the first thread actually waits on it. |
| | | </P> |
| | | <P><B>pthread_cond_init</B> initializes the condition variable <I>cond</I>, |
| | | using the condition attributes specified in <I>cond_attr</I>, or |
| | | default attributes if <I>cond_attr</I> is <B>NULL</B>. |
| | | </P> |
| | | <P>Variables of type <B>pthread_cond_t</B> can also be initialized |
| | | statically, using the constant <B>PTHREAD_COND_INITIALIZER</B>. In |
| | | the <B>Pthreads-w32</B> implementation, an application should still |
| | | call <B>pthread_cond_destroy</B> at some point to ensure that any |
| | | resources consumed by the condition variable are released.</P> |
| | | <P><B>pthread_cond_signal</B> restarts one of the threads that are |
| | | waiting on the condition variable <I>cond</I>. If no threads are |
| | | waiting on <I>cond</I>, nothing happens. If several threads are |
| | | waiting on <I>cond</I>, exactly one is restarted, but it is not |
| | | specified which. |
| | | </P> |
| | | <P><B>pthread_cond_broadcast</B> restarts all the threads that are |
| | | waiting on the condition variable <I>cond</I>. Nothing happens if no |
| | | threads are waiting on <I>cond</I>. |
| | | </P> |
| | | <P><B>pthread_cond_wait</B> atomically unlocks the <I>mutex</I> (as |
| | | per <B>pthread_unlock_mutex</B>) and waits for the condition variable |
| | | <I>cond</I> to be signalled. The thread execution is suspended and |
| | | does not consume any CPU time until the condition variable is |
| | | signalled. The <I>mutex</I> must be locked by the calling thread on |
| | | entrance to <B>pthread_cond_wait</B>. Before returning to the calling |
| | | thread, <B>pthread_cond_wait</B> re-acquires <I>mutex</I> (as per |
| | | <B>pthread_lock_mutex</B>). |
| | | </P> |
| | | <P>Unlocking the mutex and suspending on the condition variable is |
| | | done atomically. Thus, if all threads always acquire the mutex before |
| | | signalling the condition, this guarantees that the condition cannot |
| | | be signalled (and thus ignored) between the time a thread locks the |
| | | mutex and the time it waits on the condition variable. |
| | | </P> |
| | | <P><B>pthread_cond_timedwait</B> atomically unlocks <I>mutex</I> and |
| | | waits on <I>cond</I>, as <B>pthread_cond_wait</B> does, but it also |
| | | bounds the duration of the wait. If <I>cond</I> has not been |
| | | signalled within the amount of time specified by <I>abstime</I>, the |
| | | mutex <I>mutex</I> is re-acquired and <B>pthread_cond_timedwait</B> |
| | | returns the error <B>ETIMEDOUT</B>. The <I>abstime</I> parameter |
| | | specifies an absolute time, with the same origin as <A HREF="time.html"><B>time</B>(2)</A> |
| | | and <A HREF="gettimeofday.html"><B>gettimeofday</B>(2)</A>. |
| | | </P> |
| | | <P><B>pthread_cond_destroy</B> destroys a condition variable, freeing |
| | | the resources it might hold. No threads must be waiting on the |
| | | condition variable on entrance to <B>pthread_cond_destroy</B>.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P><B>pthread_cond_wait</B> and <B>pthread_cond_timedwait</B> are |
| | | cancellation points. If a thread is cancelled while suspended in one |
| | | of these functions, the thread immediately resumes execution, then |
| | | locks again the <I>mutex</I> argument to <B>pthread_cond_wait</B> and |
| | | <B>pthread_cond_timedwait</B>, and finally executes the cancellation. |
| | | Consequently, cleanup handlers are assured that <I>mutex</I> is |
| | | locked when they are called. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Async-signal Safety</A></H2> |
| | | <P>The condition functions are not async-signal safe, and should not |
| | | be called from a signal handler. In particular, calling |
| | | <B>pthread_cond_signal</B> or <B>pthread_cond_broadcast</B> from a |
| | | signal handler may deadlock the calling thread. |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Return Value</A></H2> |
| | | <P>All condition variable functions return 0 on success and a |
| | | non-zero error code on error. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Errors</A></H2> |
| | | <P><B>pthread_cond_init</B>, <B>pthread_cond_signal</B>, |
| | | <B>pthread_cond_broadcast</B>, and <B>pthread_cond_wait</B> never |
| | | return an error code. |
| | | </P> |
| | | <P>The <B>pthread_cond_init</B> function returns the following error |
| | | codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOMEM</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 4cm"> |
| | | There was not enough memory to allocate the condition variable. |
| | | </BLOCKQUOTE> |
| | | <P>The <B>pthread_cond_signal</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_cond_broadcast</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_cond_wait</B> function returns the following error |
| | | codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOMEM</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 4cm"> |
| | | There was not enough memory to allocate the statically initialised |
| | | condition variable. Statically initialised condition variables are |
| | | dynamically allocated by the first thread to wait on them.</BLOCKQUOTE> |
| | | <P>The <B>pthread_cond_timedwait</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ETIMEDOUT</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The condition variable was not signalled before the timeout |
| | | specified by <I>abstime</I> |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOMEM</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 4cm"> |
| | | There was not enough memory to allocate the statically initialised |
| | | condition variable. Statically initialised condition variables are |
| | | dynamically allocated by the first thread to wait on them. |
| | | </BLOCKQUOTE> |
| | | <P>The <B>pthread_cond_destroy</B> function returns the following |
| | | error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm; margin-right: 1cm"> |
| | | The <I>cond</I> argument is invalid. |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | Some threads are currently waiting on <I>cond</I>. |
| | | </DD></DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc7" NAME="sect7">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc8" NAME="sect8">See Also</A></H2> |
| | | <P><A HREF="pthread_condattr_init.html"><B>pthread_condattr_init</B>(3)</A> |
| | | , <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A> |
| | | , <A HREF="pthread_mutex_unlock.html"><B>pthread_mutex_unlock</B>(3)</A> |
| | | , <A HREF="pthread_cancel.html"><B>pthread_cancel(3)</B></A>. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">Example</A></H2> |
| | | <P>Consider two shared variables <I>x</I> and <I>y</I>, protected by |
| | | the mutex <I>mut</I>, and a condition variable <I>cond</I> that is to |
| | | be signaled whenever <I>x</I> becomes greater than <I>y</I>. |
| | | </P> |
| | | <PRE STYLE="margin-left: 1cm; margin-right: 1cm">int x,y; |
| | | pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; |
| | | pthread_cond_t cond = PTHREAD_COND_INITIALIZER;</PRE><BLOCKQUOTE> |
| | | Waiting until <I>x</I> is greater than <I>y</I> is performed as |
| | | follows: |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1.01cm">pthread_mutex_lock(&mut); |
| | | while (x <= y) { |
| | | pthread_cond_wait(&cond, &mut); |
| | | } |
| | | /* operate on x and y */ |
| | | pthread_mutex_unlock(&mut);</PRE><BLOCKQUOTE STYLE="margin-left: 3.01cm"> |
| | | Modifications on <I>x</I> and <I>y</I> that may cause <I>x</I> to |
| | | become greater than <I>y</I> should signal the condition if needed: |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1.01cm">pthread_mutex_lock(&mut); |
| | | /* modify x and y */ |
| | | if (x > y) pthread_cond_broadcast(&cond); |
| | | pthread_mutex_unlock(&mut);</PRE><BLOCKQUOTE STYLE="margin-left: 3.01cm"> |
| | | If it can be proved that at most one waiting thread needs to be waken |
| | | up (for instance, if there are only two threads communicating through |
| | | <I>x</I> and <I>y</I>), <B>pthread_cond_signal</B> can be used as a |
| | | slightly more efficient alternative to <B>pthread_cond_broadcast</B>. |
| | | If in doubt, use <B>pthread_cond_broadcast</B>. |
| | | </BLOCKQUOTE> |
| | | <BLOCKQUOTE STYLE="margin-left: 3.01cm">To wait for <I>x</I> to |
| | | become greater than <I>y</I> with a timeout of 5 seconds, do: |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1.01cm">struct timeval now; |
| | | struct timespec timeout; |
| | | int retcode; |
| | | pthread_mutex_lock(&mut); |
| | | gettimeofday(&now); |
| | | timeout.tv_sec = now.tv_sec + 5; |
| | | timeout.tv_nsec = now.tv_usec * 1000; |
| | | retcode = 0; |
| | | while (x <= y && retcode != ETIMEDOUT) { |
| | | retcode = pthread_cond_timedwait(&cond, &mut, &timeout); |
| | | } |
| | | if (retcode == ETIMEDOUT) { |
| | | /* timeout occurred */ |
| | | } else { |
| | | /* operate on x and y */ |
| | | } |
| | | pthread_mutex_unlock(&mut);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"><A NAME="toc"></A> |
| | | <B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Async-signal |
| | | Safety</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm; margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 0cm"><A HREF="#sect9" NAME="toc9">Example</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CONDATTR(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;16375600"> |
| | | <META NAME="CHANGED" CONTENT="20050504;16570300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_condattr_init, pthread_condattr_destroy - condition |
| | | creation |
| | | </P> |
| | | <P>attributes |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_condattr_init(pthread_condattr_t *</B><I>attr</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_condattr_destroy(pthread_condattr_t *</B><I>attr</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Condition attributes can be specified at condition creation time, |
| | | by passing a condition attribute object as second argument to |
| | | <A HREF="pthread_cond_init.html"><B>pthread_cond_init</B>(3)</A> . |
| | | Passing <B>NULL</B> is equivalent to passing a condition attribute |
| | | object with all attributes set to their default values. |
| | | </P> |
| | | <P><B>pthread_condattr_init</B> initializes the condition attribute |
| | | object <I>attr</I> and fills it with default values for the |
| | | attributes. <B>pthread_condattr_destroy</B> destroys a condition |
| | | attribute object, which must not be reused until it is reinitialized.</P> |
| | | <P><B>Pthreads-w32</B> defines _<B>POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that the attribute routines are |
| | | implemented but that the process shared attribute is not supported.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>All condition variable functions return 0 on success and a |
| | | non-zero error code on error.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_condattr_init</B> function returns the following |
| | | error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOMEM</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The was insufficient memory to create the attribute.<SPAN STYLE="font-weight: medium"> |
| | | </SPAN> |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_condattr_destroy</B> function returns the following |
| | | error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>attr</I> argument is not valid.<SPAN STYLE="font-weight: medium"> |
| | | </SPAN> |
| | | </DD></DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_cond_init.html"><B>pthread_cond_init</B>(3)</A> . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_CONDATTR_GETPSHARED"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;17542300"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18293100"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_condattr_getpshared, pthread_condattr_setpshared - get and |
| | | set the process-shared condition variable attributes |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_condattr_getpshared(const pthread_condattr_t |
| | | *restrict</B> <I>attr</I><B>, int *restrict</B> <I>pshared</I><B>); |
| | | <BR>int pthread_condattr_setpshared(pthread_condattr_t *</B><I>attr</I><B>, |
| | | int</B> <I>pshared</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_condattr_getpshared</B> function shall obtain the |
| | | value of the <I>process-shared</I> attribute from the attributes |
| | | object referenced by <I>attr</I>. The <B>pthread_condattr_setpshared</B> |
| | | function shall set the <I>process-shared</I> attribute in an |
| | | initialized attributes object referenced by <I>attr</I>. |
| | | </P> |
| | | <P>The <I>process-shared</I> attribute is set to |
| | | <B>PTHREAD_PROCESS_SHARED</B> to permit a condition variable to be |
| | | operated upon by any thread that has access to the memory where the |
| | | condition variable is allocated, even if the condition variable is |
| | | allocated in memory that is shared by multiple processes. If the |
| | | <I>process-shared</I> attribute is <B>PTHREAD_PROCESS_PRIVATE</B>, |
| | | the condition variable shall only be operated upon by threads created |
| | | within the same process as the thread that initialized the condition |
| | | variable; if threads of differing processes attempt to operate on |
| | | such a condition variable, the behavior is undefined. The default |
| | | value of the attribute is <B>PTHREAD_PROCESS_PRIVATE</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines _<B>POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented but |
| | | that the process shared attribute is not supported.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_condattr_setpshared</B> function |
| | | shall return zero; otherwise, an error number shall be returned to |
| | | indicate the error. |
| | | </P> |
| | | <P>If successful, the <B>pthread_condattr_getpshared</B> function |
| | | shall return zero and store the value of the <I>process-shared</I> |
| | | attribute of <I>attr</I> into the object referenced by the <I>pshared</I> |
| | | parameter. Otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_condattr_getpshared</B> and |
| | | <B>pthread_condattr_setpshared</B> functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_condattr_setpshared</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the attribute is outside the range of |
| | | legal values for that attribute. |
| | | </DD><DT> |
| | | <B>ENOSYS</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> was <B>PTHREAD_PROCESS_SHARED</B> |
| | | (Pthreads-w32).</DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented and |
| | | may be used, but do not support the process shared option.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> <B>,</B> |
| | | <A HREF="pthread_cond_init.html"><B>pthread_cond_destroy</B>(3)</A> <B>,</B> |
| | | <A HREF="pthread_condattr_init.html"><B>pthread_condattr_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_mutex_init.html"><B>pthread_mutex_destroy</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CREATE(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;19394700"> |
| | | <META NAME="CHANGED" CONTENT="20050504;20140200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_create - create a new thread |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_create(pthread_t * </B><I>thread</I><B>, |
| | | pthread_attr_t * </B><I>attr</I><B>, void * (*</B><I>start_routine</I><B>)(void |
| | | *), void * </B><I>arg</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_create</B> creates a new thread of control that |
| | | executes concurrently with the calling thread. The new thread applies |
| | | the function <I>start_routine</I> passing it <I>arg</I> as first |
| | | argument. The new thread terminates either explicitly, by calling |
| | | <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , or |
| | | implicitly, by returning from the <I>start_routine</I> function. The |
| | | latter case is equivalent to calling <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> |
| | | with the result returned by <I>start_routine</I> as exit code. |
| | | </P> |
| | | <P>The initial signal state of the new thread is inherited from it's |
| | | creating thread and there are no pending signals. <B>Pthreads-w32</B> |
| | | does not yet implement signals.</P> |
| | | <P>The <I>attr</I> argument specifies thread attributes to be applied |
| | | to the new thread. See <A HREF="pthread_attr_init.html"><B>pthread_attr_init</B>(3)</A> |
| | | for a complete list of thread attributes. The <I>attr</I> argument |
| | | can also be <B>NULL</B>, in which case default attributes are used: |
| | | the created thread is joinable (not detached) and has default (non |
| | | real-time) scheduling policy. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>On success, the identifier of the newly created thread is stored |
| | | in the location pointed by the <I>thread</I> argument, and a 0 is |
| | | returned. On error, a non-zero error code is returned. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <DL> |
| | | <DT><B>EAGAIN</B> |
| | | </DT><DL> |
| | | <DL> |
| | | <DT> |
| | | Not enough system resources to create a process for the new |
| | | thread, or<BR>more than <B>PTHREAD_THREADS_MAX</B> threads are |
| | | already active. |
| | | </DT></DL> |
| | | </DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> , |
| | | <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> , |
| | | <A HREF="pthread_attr_init.html"><B>pthread_attr_init</B>(3)</A> . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_DELAY_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;21371500"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_delay_np – suspend the |
| | | thread for a specified period</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_delay_np (const struct timespec *</B>interval<B>);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_delay_np</B> causes a thread to delay execution for a |
| | | specific period of time. This period ends at the current time plus |
| | | the specified interval. The routine will not return before the end of |
| | | the period is reached, but may return an arbitrary amount of time |
| | | after the period has gone by. This can be due to system load, thread |
| | | priorities, and system timer granularity.</P> |
| | | <P>Specifying an interval of zero (0) seconds and zero (0) |
| | | nanoseconds is allowed and can be used to force the thread to give up |
| | | the processor or to deliver a pending cancellation request.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P><B>pthread_delay_np </B>is a cancellation point.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P>If an error condition occurs, <B>pthread_delay_np</B> returns an |
| | | integer value indicating the type of error.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>The <B>pthread_delay_np</B> function returns the following error |
| | | code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm"> |
| | | The value specified by interval is invalid.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_DETACH(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;18010700"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20060408;9255600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_detach - put a running thread in the detached state |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_detach(pthread_t </B><I>th</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_detach</B> puts the thread <I>th</I> in the detached |
| | | state. This guarantees that the resources consumed by <I>th</I> will |
| | | be freed immediately when <I>th</I> terminates. However, this |
| | | prevents other threads from synchronizing on the termination of <I>th</I> |
| | | using <B>pthread_join</B>. If, when <B>pthread_detach</B> is called, |
| | | <I>th</I> has already terminated, all of <I>th</I>'s remaining |
| | | resources will be freed.</P> |
| | | <P>A thread can be created initially in the detached state, using the |
| | | <B>detachstate</B> attribute to <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | . In contrast, <B>pthread_detach</B> applies to threads created in |
| | | the joinable state, and which need to be put in the detached state |
| | | later. |
| | | </P> |
| | | <P>After <B>pthread_detach</B> completes, subsequent attempts to |
| | | perform <B>pthread_join</B> on <I>th</I> will fail. If another thread |
| | | is already joining the thread <I>th</I> at the time <B>pthread_detach</B> |
| | | is called, <I>th</I> will be detached and <B>pthread_join</B> will |
| | | eventually return when <I>th</I> terminates but may not return with |
| | | <I>th</I>'s correct return code. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>On success, 0 is returned. On error, a non-zero error code is |
| | | returned. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <DL> |
| | | <DT><B>ESRCH</B> |
| | | </DT><DD> |
| | | No thread could be found corresponding to that specified by <I>th</I> |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | the thread <I>th</I> is already in the detached state |
| | | </DD></DL> |
| | | <H2> |
| | | <A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with Pthreads-w32.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> , |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> , |
| | | <A HREF="pthread_attr_init.html"><B>pthread_attr_setdetachstate</B>(3)</A> |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | |
| | | <html> |
| | | <head> |
| | | <title>PTHREAD_EQUAL(3) manual page</title> |
| | | </head> |
| | | <body bgcolor='white'> |
| | | <a href='#toc'>Table of Contents</a><p> |
| | | |
| | | <p> |
| | | <h2><a name='sect0' href='#toc0'>Name</a></h2> |
| | | pthread_equal - compare two thread identifiers |
| | | <p> |
| | | <h2><a name='sect1' href='#toc1'>Synopsis</a></h2> |
| | | <b>#include <pthread.h></b> |
| | | |
| | | <p> <b>int pthread_equal(pthread_t </b><i>thread1</i><b>, pthread_t </b><i>thread2</i><b>);</b> |
| | | <p> |
| | | <h2><a name='sect2' href='#toc2'>Description</a></h2> |
| | | <b>pthread_equal</b> |
| | | determines if two thread identifiers refer to the same thread. |
| | | <p> |
| | | <h2><a name='sect3' href='#toc3'>Return Value</a></h2> |
| | | A |
| | | non-zero value is returned if <i>thread1</i> and <i>thread2</i> refer to the same thread. |
| | | Otherwise, 0 is returned. |
| | | <p> |
| | | <h2><a name='sect4' href='#toc4'>Author</a></h2> |
| | | Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | <p> |
| | | <h2><a name='sect5' href='#toc5'>See Also</a></h2> |
| | | <a href='file:pthread_self.html'><b>pthread_self</b>(3)</a> |
| | | . |
| | | <p> |
| | | |
| | | <hr><p> |
| | | <a name='toc'><b>Table of Contents</b></a><p> |
| | | <ul> |
| | | <li><a name='toc0' href='#sect0'>Name</a></li> |
| | | <li><a name='toc1' href='#sect1'>Synopsis</a></li> |
| | | <li><a name='toc2' href='#sect2'>Description</a></li> |
| | | <li><a name='toc3' href='#sect3'>Return Value</a></li> |
| | | <li><a name='toc4' href='#sect4'>Author</a></li> |
| | | <li><a name='toc5' href='#sect5'>See Also</a></li> |
| | | </ul> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | |
| | | <html> |
| | | <head> |
| | | <title>PTHREAD_EXIT(3) manual page</title> |
| | | </head> |
| | | <body bgcolor='white'> |
| | | <a href='#toc'>Table of Contents</a><p> |
| | | |
| | | <p> |
| | | <h2><a name='sect0' href='#toc0'>Name</a></h2> |
| | | pthread_exit - terminate the calling thread |
| | | <p> |
| | | <h2><a name='sect1' href='#toc1'>Synopsis</a></h2> |
| | | <b>#include <pthread.h></b> |
| | | |
| | | <p> <b>void pthread_exit(void *</b><i>retval</i><b>);</b> |
| | | <p> |
| | | <h2><a name='sect2' href='#toc2'>Description</a></h2> |
| | | <b>pthread_exit</b> terminates the |
| | | execution of the calling thread. All cleanup handlers that have been set |
| | | for the calling thread with <a href='file:pthread_cleanup_push.html'><b>pthread_cleanup_push</b>(3)</a> |
| | | are executed in reverse |
| | | order (the most recently pushed handler is executed first). Finalization |
| | | functions for thread-specific data are then called for all keys that have |
| | | non- <b>NULL</b> values associated with them in the calling thread (see <a href='file:pthread_key_create.html'><b>pthread_key_create</b>(3)</a> |
| | | ). |
| | | Finally, execution of the calling thread is stopped. |
| | | <p> The <i>retval</i> argument |
| | | is the return value of the thread. It can be consulted from another thread |
| | | using <a href='file:pthread_join.html'><b>pthread_join</b>(3)</a> |
| | | . |
| | | <p> |
| | | <h2><a name='sect3' href='#toc3'>Return Value</a></h2> |
| | | The <b>pthread_exit</b> function never returns. |
| | | |
| | | <p> |
| | | <h2><a name='sect4' href='#toc4'>Author</a></h2> |
| | | Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | <p> |
| | | <h2><a name='sect5' href='#toc5'>See Also</a></h2> |
| | | <a href='file:pthread_create.html'><b>pthread_create</b>(3)</a> |
| | | , <a href='file:pthread_join.html'><b>pthread_join</b>(3)</a> |
| | | . |
| | | <p> |
| | | |
| | | <hr><p> |
| | | <a name='toc'><b>Table of Contents</b></a><p> |
| | | <ul> |
| | | <li><a name='toc0' href='#sect0'>Name</a></li> |
| | | <li><a name='toc1' href='#sect1'>Synopsis</a></li> |
| | | <li><a name='toc2' href='#sect2'>Description</a></li> |
| | | <li><a name='toc3' href='#sect3'>Return Value</a></li> |
| | | <li><a name='toc4' href='#sect4'>Author</a></li> |
| | | <li><a name='toc5' href='#sect5'>See Also</a></li> |
| | | </ul> |
| | | </body> |
| | | </html> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_GETW32THREADHANDLE_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20110326;18290500"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | <STYLE TYPE="text/css"> |
| | | <!-- |
| | | H4.cjk { font-family: "AR PL UMing CN" } |
| | | H4.ctl { font-family: "Lohit Devanagari" } |
| | | H2.cjk { font-family: "AR PL UMing CN" } |
| | | H2.ctl { font-family: "Lohit Devanagari" } |
| | | --> |
| | | </STYLE> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4 CLASS="western">POSIX Threads for Windows – REFERENCE - |
| | | <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2 CLASS="western"><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: normal">pthread_getunique_np – get the |
| | | unique sequence number associated with a thread</P> |
| | | <H2 CLASS="western"><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>unsigned long long pthread_getunique_np(pthread_t</B> <I>thread</I><B>);</B></P> |
| | | <H2 CLASS="western"><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Returns the <B>unique </B><SPAN STYLE="font-weight: normal">64 bit |
| | | sequence number</SPAN> assigned to <I>thread</I>.</P> |
| | | <P>In <B>Pthreads-win32:</B></P> |
| | | <UL> |
| | | <LI><P>the value returned is not reused after the thread terminates |
| | | so it is unique for the life of the process</P> |
| | | <LI><P>Windows native threads may obtain their own POSIX thread |
| | | sequence number by first retrieving their <B>pthread_t</B> handle |
| | | via <B>pthread_self</B> to use as the <I>thread</I> argument.</P> |
| | | </UL> |
| | | <P>This function was added for source code compatibility with some |
| | | other POSIX threads implementations.</P> |
| | | <H2 CLASS="western"><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2 CLASS="western"><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P><B>pthread_getunique_np</B> returns the unique sequence number for |
| | | <I>thread</I>.</P> |
| | | <H2 CLASS="western"><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>None.</P> |
| | | <H2 CLASS="western"><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_GETW32THREADHANDLE_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;21523500"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_getw32threadhandle_np – get |
| | | the Win32 thread handle associated with a thread</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>HANDLE pthread_getw32threadhandle_np(pthread_t</B> <I>thread</I><B>);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Returns the Win32 native thread <B>HANDLE</B> that the POSIX |
| | | thread <I>thread</I> is running as.</P> |
| | | <P>Applications can use the Win32 handle to set Win32 specific |
| | | attributes of the thread.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P><B>pthread_getw32threadhandle_np</B> returns the Win32 native |
| | | thread <B>HANDLE</B> for the specified POSIX thread <I>thread</I>.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_JOIN(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;18232700"> |
| | | <META NAME="CHANGED" CONTENT="20050504;18421400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_join - wait for termination of another thread |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_join(pthread_t </B><I>th</I><B>, void |
| | | **</B><I>thread_return</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_join</B> suspends the execution of the calling thread |
| | | until the thread identified by <I>th</I> terminates, either by |
| | | calling <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> or by |
| | | being cancelled. |
| | | </P> |
| | | <P>If <I>thread_return</I> is not <B>NULL</B>, the return value of <I>th</I> |
| | | is stored in the location pointed to by <I>thread_return</I>. The |
| | | return value of <I>th</I> is either the argument it gave to |
| | | <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , or |
| | | <B>PTHREAD_CANCELED</B> if <I>th</I> was cancelled. |
| | | </P> |
| | | <P>The joined thread <B>th</B> must be in the joinable state: it must |
| | | not have been detached using <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> |
| | | or the <B>PTHREAD_CREATE_DETACHED</B> attribute to <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | . |
| | | </P> |
| | | <P>When a joinable thread terminates, its memory resources (thread |
| | | descriptor and stack) are not deallocated until another thread |
| | | performs <B>pthread_join</B> on it. Therefore, <B>pthread_join</B> |
| | | must be called once for each joinable thread created to avoid memory |
| | | leaks. |
| | | </P> |
| | | <P>At most one thread can wait for the termination of a given thread. |
| | | Calling <B>pthread_join</B> on a thread <I>th</I> on which another |
| | | thread is already waiting for termination returns an error. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P><B>pthread_join</B> is a cancellation point. If a thread is |
| | | cancelled while suspended in <B>pthread_join</B>, the thread |
| | | execution resumes immediately and the cancellation is executed |
| | | without waiting for the <I>th</I> thread to terminate. If |
| | | cancellation occurs during <B>pthread_join</B>, the <I>th</I> thread |
| | | remains not joined. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P>On success, the return value of <I>th</I> is stored in the |
| | | location pointed to by <I>thread_return</I>, and 0 is returned. On |
| | | error, a non-zero error code is returned. |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <DL> |
| | | <DT><B>ESRCH</B> |
| | | </DT><DD> |
| | | No thread could be found corresponding to that specified by <I>th</I>. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD> |
| | | The <I>th</I> thread has been detached. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD> |
| | | Another thread is already waiting on termination of <I>th</I>. |
| | | </DD><DT> |
| | | <B>EDEADLK</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The <I>th</I> argument refers to the calling thread. |
| | | </DD></DL> |
| | | <H2> |
| | | <A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">See Also</A></H2> |
| | | <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , |
| | | <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> , |
| | | <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> , |
| | | <A HREF="pthread_attr_setdetachstate.html"><B>pthread_attr_setdetachstate</B>(3)</A> |
| | | , <A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_push</B>(3)</A> |
| | | , <A HREF="pthread_key_create.html"><B>pthread_key_create</B>(3)</A> |
| | | . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect7" NAME="toc7">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_SPECIFIC(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;18425400"> |
| | | <META NAME="CHANGED" CONTENT="20050509;18220200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_key_create, pthread_key_delete, pthread_setspecific, |
| | | pthread_getspecific - management of thread-specific data |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_key_create(pthread_key_t *</B><I>key</I><B>, void |
| | | (*</B><I>destr_function</I><B>) (void *));</B> |
| | | </P> |
| | | <P><B>int pthread_key_delete(pthread_key_t </B><I>key</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setspecific(pthread_key_t </B><I>key</I><B>, const |
| | | void *</B><I>pointer</I><B>);</B> |
| | | </P> |
| | | <P><B>void * pthread_getspecific(pthread_key_t </B><I>key</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Programs often need global or static variables that have different |
| | | values in different threads. Since threads share one memory space, |
| | | this cannot be achieved with regular variables. Thread-specific data |
| | | is the POSIX threads answer to this need. |
| | | </P> |
| | | <P>Each thread possesses a private memory block, the thread-specific |
| | | data area, or TSD area for short. This area is indexed by TSD keys. |
| | | The TSD area associates values of type <B>void *</B> to TSD keys. TSD |
| | | keys are common to all threads, but the value associated with a given |
| | | TSD key can be different in each thread. |
| | | </P> |
| | | <P>For concreteness, the TSD areas can be viewed as arrays of <B>void |
| | | *</B> pointers, TSD keys as integer indices into these arrays, and |
| | | the value of a TSD key as the value of the corresponding array |
| | | element in the calling thread. |
| | | </P> |
| | | <P>When a thread is created, its TSD area initially associates <B>NULL</B> |
| | | with all keys. |
| | | </P> |
| | | <P><B>pthread_key_create</B> allocates a new TSD key. The key is |
| | | stored in the location pointed to by <I>key</I>. There is a limit of |
| | | <B>PTHREAD_KEYS_MAX</B> on the number of keys allocated at a given |
| | | time. The value initially associated with the returned key is <B>NULL</B> |
| | | in all currently executing threads. |
| | | </P> |
| | | <P>The <I>destr_function</I> argument, if not <B>NULL</B>, specifies |
| | | a destructor function associated with the key. When a thread |
| | | terminates via <B>pthread_exit</B> or by cancellation, <I>destr_function</I> |
| | | is called with arguments the value associated with the key in that |
| | | thread. The <I>destr_function</I> is not called if that value is <B>NULL</B><SPAN STYLE="font-weight: medium"> |
| | | or the key has been deleted</SPAN>. The order in which destructor |
| | | functions are called at thread termination time is unspecified. |
| | | </P> |
| | | <P>Before the destructor function is called, the <B>NULL</B> value is |
| | | associated with the key in the current thread. A destructor function |
| | | might, however, re-associate non- <B>NULL</B> values to that key or |
| | | some other key. To deal with this, if after all the destructors have |
| | | been called for all non- <B>NULL</B> values, there are still some |
| | | non- <B>NULL</B> values with associated destructors, then the process |
| | | is repeated.</P> |
| | | <P><B>pthread_key_delete</B> deallocates a TSD key. It does not check |
| | | whether non- <B>NULL</B> values are associated with that key in the |
| | | currently executing threads, nor call the destructor function |
| | | associated with the key. |
| | | </P> |
| | | <P><B>pthread_setspecific</B> changes the value associated with <I>key</I> |
| | | in the calling thread, storing the given <I>pointer</I> instead. |
| | | </P> |
| | | <P><B>pthread_getspecific</B> returns the value currently associated |
| | | with <I>key</I> in the calling thread. |
| | | </P> |
| | | <P>The routines <B>pthread_setspecific</B>, <B>pthread_getspecific</B>, |
| | | and <B>pthread_key_delete</B> can be called from <I>destr_function</I> |
| | | targeting any valid key including the key on which <I>destr_function</I> |
| | | is currently operating. If <B>pthread_getspecific</B> is called on |
| | | the key whose thread specific data is being destroyed, the value NULL |
| | | is returned, unless <B>pthread_setspecific</B> was called previously |
| | | on that key from within <I>destr_function</I> to set the value to |
| | | non-NULL. For some implementations the effect of calling |
| | | <B>pthread_setspecific</B> from within <I>destr_function</I> can be |
| | | either memory leakage or infinite loops if <I>destr_function</I> has |
| | | already been called at least <B>PTHREAD_DESTRUCTOR_ITERATIONS</B> |
| | | times.</P> |
| | | <P STYLE="font-weight: medium"><B>Pthreads-w32</B> stops running key |
| | | <I>destr_function</I> routines after <B>PTHREAD_DESTRUCTOR_ITERATIONS</B> |
| | | iterations, even if some non- <B>NULL</B> values with associated |
| | | descriptors remain. If memory is allocated and associated with a key |
| | | from within <I>destr_function</I>, that memory may not be reclaimed |
| | | because that key's <I>destr_function</I>, may not run again.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P><B>pthread_key_create</B>, <B>pthread_key_delete</B>, and |
| | | <B>pthread_setspecific</B> return 0 on success and a non-zero error |
| | | code on failure. If successful, <B>pthread_key_create</B> stores the |
| | | newly allocated key in the location pointed to by its <I>key</I> |
| | | argument. |
| | | </P> |
| | | <P><B>pthread_getspecific</B> returns the value associated with <I>key</I> |
| | | on success, and <B>NULL</B> on error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P><B>pthread_key_create</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EAGAIN</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 5cm"> |
| | | <B>PTHREAD_KEYS_MAX</B> keys are already allocated |
| | | </BLOCKQUOTE> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOMEM</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 5cm"> |
| | | Insufficient memory to allocate the key. |
| | | </BLOCKQUOTE> |
| | | <P><B>pthread_key_delete</B> and <B>pthread_setspecific</B> return |
| | | the following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>key</I> is not a valid, allocated TSD key |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | <B>pthread_getspecific</B> returns <B>NULL</B> if <I>key</I> is not a |
| | | valid, allocated TSD key. |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_create.html">pthread_create(3)</A> , |
| | | <A HREF="pthread_exit.html">pthread_exit(3)</A> , |
| | | <A HREF="pthread_cancel.html">pthread_testcancel(3)</A> . |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Example</A></H2> |
| | | <P>The following code fragment allocates a thread-specific array of |
| | | 100 characters, with automatic reclamation at thread exit: |
| | | </P> |
| | | <BLOCKQUOTE><BR><BR> |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1cm; margin-right: 1cm">/* Key for the thread-specific buffer */ |
| | | static pthread_key_t buffer_key; |
| | | /* Once-only initialisation of the key */ |
| | | static pthread_once_t buffer_key_once = PTHREAD_ONCE_INIT; |
| | | /* Allocate the thread-specific buffer */ |
| | | void buffer_alloc(void) |
| | | { |
| | | pthread_once(&buffer_key_once, buffer_key_alloc); |
| | | pthread_setspecific(buffer_key, malloc(100)); |
| | | } |
| | | /* Return the thread-specific buffer */ |
| | | char * get_buffer(void) |
| | | { |
| | | return (char *) pthread_getspecific(buffer_key); |
| | | } |
| | | /* Allocate the key */ |
| | | static void buffer_key_alloc() |
| | | { |
| | | pthread_key_create(&buffer_key, buffer_destroy); |
| | | } |
| | | /* Free the thread-specific buffer */ |
| | | static void buffer_destroy(void * buf) |
| | | { |
| | | free(buf); |
| | | }</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE STYLE="margin-left: 0cm; margin-right: 0cm"><A NAME="toc"></A> |
| | | <B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE><A HREF="#sect7" NAME="toc7">Example</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_SIGNAL(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;18500100"> |
| | | <META NAME="CHANGED" CONTENT="20050504;23005800"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_sigmask, pthread_kill, sigwait - handling of signals in |
| | | threads |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> <BR><B>#include <signal.h></B> |
| | | </P> |
| | | <P><B>int pthread_sigmask(int </B><I>how</I><B>, const sigset_t |
| | | *</B><I>newmask</I><B>, sigset_t *</B><I>oldmask</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_kill(pthread_t </B><I>thread</I><B>, int </B><I>signo</I><B>);</B> |
| | | </P> |
| | | <P><B>int sigwait(const sigset_t *</B>set, <B>int</B> *sig);</P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_sigmask</B> changes the signal mask for the calling |
| | | thread as described by the <I>how</I> and <I>newmask</I> arguments. |
| | | If <I>oldmask</I> is not <B>NULL</B>, the previous signal mask is |
| | | stored in the location pointed to by <I>oldmask</I>. <B>Pthreads-w32</B> |
| | | implements this function but no other function uses the signal mask |
| | | yet.</P> |
| | | <P>The meaning of the <I>how</I> and <I>newmask</I> arguments is the |
| | | same as for <B><SPAN STYLE="font-style: normal">sigprocmask</SPAN></B>(2). |
| | | If <I>how</I> is <B>SIG_SETMASK</B>, the signal mask is set to |
| | | <I>newmask</I>. If <I>how</I> is <B>SIG_BLOCK</B>, the signals |
| | | specified to <I>newmask</I> are added to the current signal mask. If |
| | | <I>how</I> is <B>SIG_UNBLOCK</B>, the signals specified to <I>newmask</I> |
| | | are removed from the current signal mask. |
| | | </P> |
| | | <P>Recall that signal masks are set on a per-thread basis, but signal |
| | | actions and signal handlers, as set with <B>sigaction</B>(2), are |
| | | shared between all threads. |
| | | </P> |
| | | <P><B>pthread_kill</B> send signal number <I>signo</I> to the thread |
| | | <I>thread</I>. <B>Pthreads-w32</B> only supports signal number 0, |
| | | which does not send any signal but causes <B>pthread_kill</B> to |
| | | return an error if <I>thread</I> is not valid.</P> |
| | | <P><B>sigwait</B> suspends the calling thread until one of the |
| | | signals in <I>set</I> is delivered to the calling thread. It then |
| | | stores the number of the signal received in the location pointed to |
| | | by <I>sig</I> and returns. The signals in <I>set</I> must be blocked |
| | | and not ignored on entrance to <B>sigwait</B>. If the delivered |
| | | signal has a signal handler function attached, that function is <I>not</I> |
| | | called. <B>Pthreads-w32</B> implements this function as a |
| | | cancellation point only - it does not wait for any signals and does |
| | | not change the location pointed to by <I>sig</I>.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P><B>sigwait</B> is a cancellation point. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P>On success, 0 is returned. On failure, a non-zero error code is |
| | | returned. |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>The <B>pthread_sigmask</B> function returns the following error |
| | | codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>how</I> is not one of <B>SIG_SETMASK</B>, <B>SIG_BLOCK</B>, or |
| | | <B>SIG_UNBLOCK</B> |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_kill</B> function returns the following error codes on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>signo</I> is not a valid signal number or is unsupported.</DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the thread <I>thread</I> does not exist (e.g. it has already |
| | | terminated) |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>sigwait</B> function never returns an error. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">See Also</A></H2> |
| | | <P> |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Notes</A></H2> |
| | | <P>In any implementation, for <B>sigwait</B> to work reliably, the |
| | | signals being waited for must be blocked in all threads, not only in |
| | | the calling thread, since otherwise the POSIX semantics for signal |
| | | delivery do not guarantee that it’s the thread doing the <B>sigwait</B> |
| | | that will receive the signal. The best way to achieve this is to |
| | | block those signals before any threads are created, and never unblock |
| | | them in the program other than by calling <B>sigwait</B>. This works |
| | | because all threads inherit their initial sigmask from their creating |
| | | thread.</P> |
| | | <H2><A HREF="#toc9" NAME="sect9">Bugs</A></H2> |
| | | <P><B>Pthreads-w32</B> does not implement signals yet and so these |
| | | routines have almost no use except to prevent the compiler or linker |
| | | from complaining. <B>pthread_kill</B> is useful in determining if the |
| | | thread is a valid thread, but since many threads implementations |
| | | reuse thread IDs, the valid thread may no longer be the thread you |
| | | think it is, and so this method of determining thread validity is not |
| | | portable, and very risky. <B>Pthreads-w32</B> from version 1.0.0 |
| | | onwards implements pseudo-unique thread IDs, so applications that use |
| | | this technique (but really shouldn't) have some protection.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Notes</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect9" NAME="toc9">Bugs</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_MUTEX(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;5000"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20110326;15072100"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | <STYLE TYPE="text/css"> |
| | | <!-- |
| | | H4.cjk { font-family: "AR PL UMing CN" } |
| | | H4.ctl { font-family: "Lohit Devanagari" } |
| | | H2.cjk { font-family: "AR PL UMing CN" } |
| | | H2.ctl { font-family: "Lohit Devanagari" } |
| | | PRE.cjk { font-family: "AR PL UMing CN", monospace } |
| | | PRE.ctl { font-family: "Lohit Devanagari", monospace } |
| | | --> |
| | | </STYLE> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4 CLASS="western">POSIX Threads for Windows – REFERENCE - |
| | | <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2 CLASS="western"><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, |
| | | pthread_mutex_timedlock, pthread_mutex_unlock, |
| | | pthread_mutex_consistent, pthread_mutex_destroy - operations on |
| | | mutexes |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>#include <time.h></B></P> |
| | | <P><B>pthread_mutex_t </B><I>fastmutex</I> <B>= |
| | | PTHREAD_MUTEX_INITIALIZER;</B> |
| | | </P> |
| | | <P><B>pthread_mutex_t </B><I>recmutex</I> <B>= |
| | | PTHREAD_RECURSIVE_MUTEX_INITIALIZER;</B> |
| | | </P> |
| | | <P><B>pthread_mutex_t </B><I>errchkmutex</I> <B>= |
| | | PTHREAD_ERRORCHECK_MUTEX_INITIALIZER;</B> |
| | | </P> |
| | | <P><B>pthread_mutex_t </B><I>recmutex</I> <B>= |
| | | PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;</B> |
| | | </P> |
| | | <P><B>pthread_mutex_t </B><I>errchkmutex</I> <B>= |
| | | PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_init(pthread_mutex_t *</B><I>mutex</I><B>, |
| | | const pthread_mutexattr_t *</B><I>mutexattr</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_lock(pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_trylock(pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_timedlock(pthread_mutex_t *</B><I>mutex, |
| | | </I><B>const struct timespec *</B><I>abs_timeout</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_unlock(pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_consistent(pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_mutex_destroy(pthread_mutex_t *</B><I>mutex</I><B>);</B> |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>A mutex is a MUTual EXclusion device, and is useful for protecting |
| | | shared data structures from concurrent modifications, and |
| | | implementing critical sections and monitors. |
| | | </P> |
| | | <P>A mutex has two possible states: unlocked (not owned by any |
| | | thread), and locked (owned by one thread). A mutex can never be owned |
| | | by two different threads simultaneously. A thread attempting to lock |
| | | a mutex that is already locked by another thread is suspended until |
| | | the owning thread unlocks the mutex first. |
| | | </P> |
| | | <P><B>pthread_mutex_init</B> initializes the mutex object pointed to |
| | | by <I>mutex</I> according to the mutex attributes specified in |
| | | <I>mutexattr</I>. If <I>mutexattr</I> is <B>NULL</B>, default |
| | | attributes are used instead. |
| | | </P> |
| | | <P>The type of a mutex determines whether it can be locked again by a |
| | | thread that already owns it. The default type is “normal”. See |
| | | <A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_init</B>(3)</A> |
| | | for more information on mutex attributes. |
| | | </P> |
| | | <P>Variables of type <B>pthread_mutex_t</B> can also be initialized |
| | | statically, using the constants <B>PTHREAD_MUTEX_INITIALIZER</B> (for |
| | | normal “fast” mutexes), <B>PTHREAD_RECURSIVE_MUTEX_INITIALIZER</B> |
| | | (for recursive mutexes), and <B>PTHREAD_ERRORCHECK_MUTEX_INITIALIZER</B> |
| | | (for error checking mutexes). <SPAN STYLE="font-weight: normal">In |
| | | the </SPAN><B>Pthreads-w32</B> <SPAN STYLE="font-weight: normal">implementation, |
| | | an application should still call </SPAN><B>pthread_mutex_destroy</B> |
| | | <SPAN STYLE="font-weight: normal">at some point to ensure that any |
| | | resources consumed by the mutex are released.</SPAN></P> |
| | | <P><SPAN STYLE="font-weight: normal">Any mutex type can be |
| | | initialized as a </SPAN><B>robust mutex</B><SPAN STYLE="font-weight: normal">. |
| | | See </SPAN><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_init</B><SPAN STYLE="font-weight: normal">(3)</SPAN></A> |
| | | <SPAN STYLE="font-weight: normal">for more information as well as the |
| | | section </SPAN><I><U><SPAN STYLE="font-weight: normal">Robust Mutexes</SPAN></U></I> |
| | | <SPAN STYLE="font-weight: normal">below.</SPAN></P> |
| | | <P><B>pthread_mutex_lock</B> locks the given mutex. If the mutex is |
| | | currently unlocked, it becomes locked and owned by the calling |
| | | thread, and <B>pthread_mutex_lock</B> returns immediately. If the |
| | | mutex is already locked by another thread, <B>pthread_mutex_lock</B> |
| | | suspends the calling thread until the mutex is unlocked.</P> |
| | | <P>If the mutex is already locked by the calling thread, the behavior |
| | | of <B>pthread_mutex_lock</B> depends on the type of the mutex. If the |
| | | mutex is of the “normal” type, the calling thread is suspended |
| | | until the mutex is unlocked, thus effectively causing the calling |
| | | thread to deadlock. If the mutex is of the ‘‘error checking’’ |
| | | type, <B>pthread_mutex_lock</B> returns immediately with the error |
| | | code <B>EDEADLK</B>. If the mutex is of the ‘‘recursive’’ |
| | | type, <B>pthread_mutex_lock</B> succeeds and returns immediately, |
| | | recording the number of times the calling thread has locked the |
| | | mutex. An equal number of <B>pthread_mutex_unlock</B> operations must |
| | | be performed before the mutex returns to the unlocked state. |
| | | </P> |
| | | <P><B>pthread_mutex_trylock</B> behaves identically to |
| | | <B>pthread_mutex_lock</B>, except that it does not block the calling |
| | | thread if the mutex is already locked by another thread (or by the |
| | | calling thread in the case of a “normal” or “<SPAN STYLE="font-style: normal">errorcheck</SPAN>” |
| | | mutex). Instead, <B>pthread_mutex_trylock</B> returns immediately |
| | | with the error code <B>EBUSY</B>. |
| | | </P> |
| | | <P><B>pthread_mutex_timedlock</B> behaves identically to |
| | | <B>pthread_mutex_lock</B>, except that if it cannot acquire the lock |
| | | before the <I>abs_timeout</I> time, the call returns with the error |
| | | code <B>ETIMEDOUT</B>. If the mutex can be locked immediately it is, |
| | | and the <B>abs_timeout</B> parameter is ignored.</P> |
| | | <P><B>pthread_mutex_consistent</B> may only be called for |
| | | <B>PTHREAD_MUTEX_ROBUST</B> mutexes. It simply marks the mutex as |
| | | consistent. See <I><U>Robust Mutexes</U></I> below.</P> |
| | | <P><B>pthread_mutex_unlock</B> unlocks the given mutex. The mutex is |
| | | assumed to be locked and owned by the calling thread on entrance to |
| | | <B>pthread_mutex_unlock</B>. If the mutex is of the “normal” |
| | | type, <B>pthread_mutex_unlock</B> always returns it to the unlocked |
| | | state. If it is of the ‘‘recursive’’ type, it decrements the |
| | | locking count of the mutex (number of <B>pthread_mutex_lock</B> |
| | | operations performed on it by the calling thread), and only when this |
| | | count reaches zero is the mutex actually unlocked. In <B>Pthreads-win32</B>, |
| | | non-robust normal or default mutex types do not check the owner of |
| | | the mutex. For all types of robust mutexes the owner is checked and |
| | | an error code is returned if the calling thread does not own the |
| | | mutex.</P> |
| | | <P>On ‘‘error checking’’ mutexes, <B>pthread_mutex_unlock</B> |
| | | actually checks at run-time that the mutex is locked on entrance, and |
| | | that it was locked by the same thread that is now calling |
| | | <B>pthread_mutex_unlock</B>. If these conditions are not met, an |
| | | error code is returned and the mutex remains unchanged. ‘‘Normal’’ |
| | | [non-robust] mutexes perform no such checks, thus allowing a locked |
| | | mutex to be unlocked by a thread other than its owner. This is |
| | | non-portable behavior and is not meant to be used as a feature.</P> |
| | | <P><B>pthread_mutex_destroy</B> destroys a mutex object, freeing the |
| | | resources it might hold. The mutex must be unlocked on entrance.</P> |
| | | <H2 CLASS="western"><A HREF="#toc10" NAME="sect10">Robust Mutexes</A></H2> |
| | | <P>If the mutex is <B>PTHREAD_MUTEX_ROBUST</B> and the owning thread |
| | | terminates without unlocking the mutex the implementation will wake |
| | | one waiting thread, if any. The next thread to acquire the mutex will |
| | | receive the error code <B>EOWNERDEAD</B><SPAN STYLE="font-weight: normal">, |
| | | in which case that thread should if possible ensure that the state |
| | | protected by the mutex is consistent and then call |
| | | </SPAN><B>pthread_mutex_consistent</B> <SPAN STYLE="font-weight: normal">before |
| | | unlocking. The mutex may then be used normally from then on.</SPAN></P> |
| | | <P><SPAN STYLE="font-weight: normal">If the thread cannot recover the |
| | | state then it must call </SPAN><B>pthread_mutex_unlock</B><SPAN STYLE="font-weight: normal"> |
| | | without calling </SPAN><B>pthread_mutex_consistent</B><SPAN STYLE="font-weight: normal">. |
| | | This will mark the mutex as unusable and wake all currently waiting |
| | | threads with the return code </SPAN><B>ENOTRECOVERABLE</B><SPAN STYLE="font-weight: normal">. |
| | | The error indicates that the mutex is no longer usable and any |
| | | threads that receive this error code from any lock operation have not |
| | | acquired the mutex. The mutex can be made consistent by calling |
| | | </SPAN><B>pthread_mutex_destroy</B> <SPAN STYLE="font-weight: normal">to |
| | | uninitialize the mutex, and calling </SPAN><B>pthread_mutex_int</B> |
| | | <SPAN STYLE="font-weight: normal">to reinitialize the mutex. However, |
| | | the state that was protected by the mutex remains inconsistent and |
| | | some form of application recovery is required.</SPAN></P> |
| | | <P><SPAN STYLE="font-weight: normal">If a thread that receives the |
| | | </SPAN><B>EOWNERDEAD</B> <SPAN STYLE="font-weight: normal">error code |
| | | itself terminates without unlocking the mutex then this behaviour |
| | | repeats for the next acquiring thread.</SPAN></P> |
| | | <P><SPAN STYLE="font-weight: normal">Applications must ensure that |
| | | they check the return values from all calls targeting robust mutexes.</SPAN></P> |
| | | <P STYLE="font-weight: normal">Robust mutexes are slower because they |
| | | require some additional overhead, however they are not very much |
| | | slower than the non-robust recursive type.</P> |
| | | <H2 CLASS="western"><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None of the mutex functions is a cancellation point, not even |
| | | <B>pthread_mutex_lock</B>, in spite of the fact that it can suspend a |
| | | thread for arbitrary durations. This way, the status of mutexes at |
| | | cancellation points is predictable, allowing cancellation handlers to |
| | | unlock precisely those mutexes that need to be unlocked before the |
| | | thread stops executing. Consequently, threads using deferred |
| | | cancellation should never hold a mutex for extended periods of time. |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc4" NAME="sect4">Async-signal Safety</A></H2> |
| | | <P>The mutex functions are not async-signal safe. What this means is |
| | | that they should not be called from a signal handler. In particular, |
| | | calling <B>pthread_mutex_lock</B> or <B>pthread_mutex_unlock</B> from |
| | | a signal handler may deadlock the calling thread. |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc5" NAME="sect5">Return Value</A></H2> |
| | | <P><B>pthread_mutex_init</B> always returns 0. The other mutex |
| | | functions return 0 on success and a non-zero error code on error. |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc6" NAME="sect6">Errors</A></H2> |
| | | <P>The <B>pthread_mutex_lock</B> function returns the following error |
| | | code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"><B>EINVAL</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex has not been properly initialized. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EDEADLK</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex is already locked by the calling thread (‘‘error |
| | | checking’’ mutexes only). |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EOWNERDEAD</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is now locked by the calling thread after the |
| | | previous owner terminated without unlocking it.</DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>ENOTRECOVERABLE</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is not locked and is no longer usable after the |
| | | previous owner unlocked it without calling |
| | | pthread_mutex_consistent.</DD></DL> |
| | | <DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | The <B>pthread_mutex_trylock</B> function returns the following |
| | | error codes on error: |
| | | </DD><DL> |
| | | <DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EBUSY</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex could not be acquired because it was currently locked. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex has not been properly initialized. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EOWNERDEAD</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is now locked by the calling thread after the |
| | | previous owner terminated without unlocking it.</DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>ENOTRECOVERABLE</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is not locked and is no longer usable after the |
| | | previous owner unlocked it without calling |
| | | pthread_mutex_consistent.</DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_mutex_timedlock</B> function returns the following |
| | | error codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"><B>ETIMEDOUT</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex could not be acquired before the <I>abs_timeout</I> time |
| | | arrived. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex has not been properly initialized. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EOWNERDEAD</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is now locked by the calling thread after the |
| | | previous owner terminated without unlocking it.</DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>ENOTRECOVERABLE</B></DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the robust mutex is not locked and is no longer usable after the |
| | | previous owner unlocked it without calling |
| | | pthread_mutex_consistent.</DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_mutex_unlock</B> function returns the following error |
| | | code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex has not been properly initialized. |
| | | </DD><DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | <B>EPERM</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the calling thread does not own the mutex (‘‘error checking’’ |
| | | mutexes only). |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>pthread_mutex_destroy</B> function returns the following error |
| | | code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 0.39in; margin-bottom: 0.2in"><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-right: 0.39in; margin-bottom: 0.2in"> |
| | | the mutex is currently locked. |
| | | </DD></DL> |
| | | </DL> |
| | | <H2 CLASS="western"> |
| | | <A HREF="#toc7" NAME="sect7">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2 CLASS="western"><A HREF="#toc8" NAME="sect8">See Also</A></H2> |
| | | <P><A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_init</B>(3)</A> |
| | | , <A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_settype</B>(3)</A> |
| | | , <A HREF="pthread_cancel.html"><B>pthread_cancel</B>(3)</A> . |
| | | </P> |
| | | <H2 CLASS="western"><A HREF="#toc9" NAME="sect9">Example</A></H2> |
| | | <P>A shared global variable <I>x</I> can be protected by a mutex as |
| | | follows: |
| | | </P> |
| | | <PRE CLASS="western" STYLE="margin-left: 0.39in; margin-right: 0.39in">int x; |
| | | pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;</PRE><BLOCKQUOTE STYLE="margin-left: 0in; margin-right: 0in"> |
| | | All accesses and modifications to <I>x</I> should be bracketed by |
| | | calls to <B>pthread_mutex_lock</B> and <B>pthread_mutex_unlock</B> as |
| | | follows: |
| | | </BLOCKQUOTE> |
| | | <PRE CLASS="western" STYLE="margin-left: 0.41in; margin-right: 0.79in">pthread_mutex_lock(&mut); |
| | | /* operate on x */ |
| | | pthread_mutex_unlock(&mut);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE STYLE="margin-right: 2.75in"><A NAME="toc"></A><B>Table |
| | | of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect10" NAME="toc10">Robust |
| | | Mutexes</A></BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect4" NAME="toc4">Async-signal |
| | | Safety</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect5" NAME="toc5">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect6" NAME="toc6">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect7" NAME="toc7">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in; margin-bottom: 0in"><A HREF="#sect8" NAME="toc8">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-right: 2.75in"><A HREF="#sect9" NAME="toc9">Example</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
| | | <HTML>
|
| | | <HEAD>
|
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
|
| | | <TITLE>PTHREAD_MUTEXATTR(3) manual page</TITLE>
|
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2 (Linux)">
|
| | | <META NAME="CREATED" CONTENT="20050504;23040500">
|
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson">
|
| | | <META NAME="CHANGED" CONTENT="20110326;13190500">
|
| | | <!-- manual page source format generated by PolyglotMan v3.2, -->
|
| | | <!-- available at http://polyglotman.sourceforge.net/ -->
|
| | | <STYLE TYPE="text/css">
|
| | | <!--
|
| | | H4.cjk { font-family: "AR PL UMing CN" }
|
| | | H4.ctl { font-family: "Lohit Devanagari" }
|
| | | H2.cjk { font-family: "AR PL UMing CN" }
|
| | | H2.ctl { font-family: "Lohit Devanagari" }
|
| | | -->
|
| | | </STYLE>
|
| | | </HEAD>
|
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR">
|
| | | <H4 CLASS="western">POSIX Threads for Windows – REFERENCE -
|
| | | <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4>
|
| | | <P><A HREF="index.html">Reference Index</A></P>
|
| | | <P><A HREF="#toc">Table of Contents</A></P>
|
| | | <H2 CLASS="western"><A HREF="#toc0" NAME="sect0">Name</A></H2>
|
| | | <P>pthread_mutexattr_init, pthread_mutexattr_destroy,
|
| | | pthread_mutexattr_settype, pthread_mutexattr_gettype - mutex creation
|
| | | attributes |
| | | </P>
|
| | | <H2 CLASS="western"><A HREF="#toc1" NAME="sect1">Synopsis</A></H2>
|
| | | <P><B>#include <pthread.h></B> |
| | | </P>
|
| | | <P><B>int pthread_mutexattr_init(pthread_mutexattr_t *</B><I>attr</I><B>);</B>
|
| | | </P>
|
| | | <P><B>int pthread_mutexattr_destroy(pthread_mutexattr_t *</B><I>attr</I><B>);</B>
|
| | | </P>
|
| | | <P><B>int pthread_mutexattr_settype(pthread_mutexattr_t *</B><I>attr</I><B>,
|
| | | int </B><I>type</I><B>);</B> |
| | | </P>
|
| | | <P><B>int pthread_mutexattr_gettype(const pthread_mutexattr_t *</B><I>attr</I><B>,
|
| | | int *</B><I>type</I><B>);</B> |
| | | </P>
|
| | | <P><B>int pthread_mutexattr_setkind_np(pthread_mutexattr_t *</B><I>attr</I><B>,
|
| | | int </B><I>type</I><B>);</B> |
| | | </P>
|
| | | <P><B>int pthread_mutexattr_getkind_np(const pthread_mutexattr_t
|
| | | *</B><I>attr</I><B>, int *</B><I>type</I><B>);</B> |
| | | </P>
|
| | | <P><B>int pthread_mutexattr_setrobust(pthread_mutexattr_t *</B><I>attr</I><B>,
|
| | | int</B><SPAN STYLE="font-weight: normal"> </SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><B>);</B>
|
| | | </P>
|
| | | <P><B>int pthread_mutexattr_getrobust(pthread_mutexattr_t *</B><I>attr</I><B>,
|
| | | int</B><SPAN STYLE="font-weight: normal"> </SPAN><B>*</B><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><B>);</B>
|
| | | </P>
|
| | | <H2 CLASS="western"><A HREF="#toc2" NAME="sect2">Description</A></H2>
|
| | | <P>Mutex attributes can be specified at mutex creation time, by
|
| | | passing a mutex attribute object as second argument to
|
| | | <A HREF="pthread_mutex_init.html"><B>pthread_mutex_init</B>(3)</A> .
|
| | | Passing <B>NULL</B> is equivalent to passing a mutex attribute object
|
| | | with all attributes set to their default values. |
| | | </P>
|
| | | <P><B>pthread_mutexattr_init</B> initializes the mutex attribute
|
| | | object <I>attr</I> and fills it with default values for the
|
| | | attributes. |
| | | </P>
|
| | | <P><B>pthread_mutexattr_destroy</B> destroys a mutex attribute
|
| | | object, which must not be reused until it is reinitialized.</P>
|
| | | <P><B>pthread_mutexattr_settype</B> sets the mutex type attribute in
|
| | | <I>attr</I> to the value specified by <I>type</I>. |
| | | </P>
|
| | | <P><B>pthread_mutexattr_gettype</B> retrieves the current value of
|
| | | the mutex kind attribute in <I>attr</I> and stores it in the location
|
| | | pointed to by <I>type</I>. |
| | | </P>
|
| | | <P><B>Pthreads-w32</B> also recognises the following equivalent
|
| | | functions that are used in Linux:</P>
|
| | | <P><B>pthread_mutexattr_setkind_np</B> is an alias for
|
| | | <B>pthread_mutexattr_settype</B>. |
| | | </P>
|
| | | <P STYLE="font-weight: normal"><B>pthread_mutexattr_getkind_np</B> is
|
| | | an alias for <B>pthread_mutexattr_gettype</B>. |
| | | </P>
|
| | | <P>The following mutex types are supported:</P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_NORMAL</B> - for
|
| | | ‘‘fast’’ mutexes.</P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_RECURSIVE</B> - for
|
| | | ‘‘recursive’’ mutexes.</P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_ERRORCHECK</B> - for
|
| | | ‘‘error checking’’ mutexes.</P>
|
| | | <P>The mutex type determines what happens if a thread attempts to
|
| | | lock a mutex it already owns with <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A>
|
| | | . If the mutex is of the “normal” or “fast” type,
|
| | | <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A>
|
| | | simply suspends the calling thread forever. If the mutex is of the
|
| | | ‘‘error checking’’ type, <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A>
|
| | | returns immediately with the error code <B>EDEADLK</B>. If the mutex
|
| | | is of the ‘‘recursive’’ type, the call to
|
| | | <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A>
|
| | | returns immediately with a success return code. The number of times
|
| | | the thread owning the mutex has locked it is recorded in the mutex.
|
| | | The owning thread must call <A HREF="pthread_mutex_unlock.html"><B>pthread_mutex_unlock</B>(3)</A>
|
| | | the same number of times before the mutex returns to the unlocked
|
| | | state. |
| | | </P>
|
| | | <P>The default mutex type is <B>PTHREAD_MUTEX_NORMAL</B></P>
|
| | | <P><B>Pthreads-w32</B> also recognises the following equivalent types
|
| | | that are used by Linux:</P>
|
| | | <P STYLE="margin-left: 0.79in; font-weight: normal"><B>PTHREAD_MUTEX_FAST_NP</B>
|
| | | – equivalent to <B>PTHREAD_MUTEX_NORMAL</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_RECURSIVE_NP</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_ERRORCHECK_NP</B></P>
|
| | | <P><B>pthread_mutexattr_setrobust</B><SPAN STYLE="font-weight: normal">
|
| | | sets the robustness attribute to the value given by </SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><SPAN STYLE="font-weight: normal">.</SPAN></P>
|
| | | <P><B>pthread_mutexattr_getrobust</B><SPAN STYLE="font-weight: normal">
|
| | | returns the current robustness value to the location given by
|
| | | *</SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><SPAN STYLE="font-weight: normal">.</SPAN></P>
|
| | | <P><SPAN STYLE="font-weight: normal">The possible values for </SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | are:</SPAN></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_STALLED</B><SPAN STYLE="font-weight: normal">
|
| | | - when the owner of the mutex terminates without unlocking the mutex,
|
| | | all subsequent calls
to pthread_mutex_*lock() are blocked from
|
| | | progress in an unspecified manner.</SPAN></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>PTHREAD_MUTEX_ROBUST</B><SPAN STYLE="font-weight: normal">
|
| | | - when the owner of the mutex terminates without unlocking the mutex,
|
| | | the mutex is
unlocked. The next owner of this mutex acquires the
|
| | | mutex with an error return of
EOWNERDEAD.</SPAN></P>
|
| | | <H2 CLASS="western"><A HREF="#toc3" NAME="sect3">Return Value</A></H2>
|
| | | <P><SPAN STYLE="font-weight: normal">On success all functions return
|
| | | 0, otherwise they return an error code as follows:</SPAN></P>
|
| | | <P><B>pthread_mutexattr_init</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>ENOMEM</B><SPAN STYLE="font-weight: normal">
|
| | | - insufficient memory for </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">.</SPAN></P>
|
| | | <P><B>pthread_mutexattr_destroy</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>EINVAL</B><SPAN STYLE="font-weight: normal">
|
| | | - </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is invalid.</SPAN></P>
|
| | | <P><B>pthread_mutexattr_gettype</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>EINVAL</B><SPAN STYLE="font-weight: normal">
|
| | | - </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is invalid.</SPAN></P>
|
| | | <P><B>pthread_mutexattr_settype</B></P>
|
| | | <DL>
|
| | | <DL>
|
| | | <DL>
|
| | | <DT><B>EINVAL</B><SPAN STYLE="font-weight: normal"> - </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is invalid or </SPAN><I><SPAN STYLE="font-weight: normal">type</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is none of:</SPAN></DT><DL>
|
| | | <DL>
|
| | | <DT>
|
| | | <B>PTHREAD_MUTEX_NORMAL<BR>PTHREAD_MUTEX_FAST_NP<BR>PTHREAD_MUTEX_RECURSIVE<BR>PTHREAD_MUTEX_RECURSIVE_NP<BR>PTHREAD_MUTEX_ERRORCHECK<BR>PTHREAD_MUTEX_ERRORCHECK_NP</B></DT></DL>
|
| | | </DL>
|
| | | </DL>
|
| | | </DL>
|
| | | <DD STYLE="margin-left: 0in">
|
| | | <BR>
|
| | | </DD></DL>
|
| | | <P>
|
| | | <B>pthread_mutexattr_getrobust</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>EINVAL</B><SPAN STYLE="font-weight: normal">
|
| | | – </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | or </SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is invalid.</SPAN></P>
|
| | | <P><B>pthread_mutexattr_setrobust</B></P>
|
| | | <P STYLE="margin-left: 0.79in"><B>EINVAL</B><SPAN STYLE="font-weight: normal">
|
| | | – </SPAN><I><SPAN STYLE="font-weight: normal">attr</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | or </SPAN><I><SPAN STYLE="font-weight: normal">robust</SPAN></I><SPAN STYLE="font-weight: normal">
|
| | | is invalid.</SPAN></P>
|
| | | <H2 CLASS="western"><A HREF="#toc5" NAME="sect5">Author</A></H2>
|
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P>
|
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P>
|
| | | <H2 CLASS="western"><A HREF="#toc6" NAME="sect6">See Also</A></H2>
|
| | | <P><A HREF="pthread_mutex_init.html"><B>pthread_mutex_init</B>(3)</A>
|
| | | , <A HREF="pthread_mutex_lock.html"><B>pthread_mutex_lock</B>(3)</A>
|
| | | , <A HREF="pthread_mutex_unlock.html"><B>pthread_mutex_unlock</B>(3)</A>
|
| | | . |
| | | </P>
|
| | | <H2 CLASS="western"><A HREF="#toc7" NAME="sect7"><FONT COLOR="#000080"><U>Notes</U></FONT></A></H2>
|
| | | <P>For speed, <B>Pthreads-w32</B> never checks the thread ownership
|
| | | of non-robust mutexes of type <B>PTHREAD_MUTEX_NORMAL</B> (or
|
| | | <B>PTHREAD_MUTEX_FAST_NP</B>) when performing operations on the
|
| | | mutex. It is therefore possible for one thread to lock such a mutex
|
| | | and another to unlock it.</P>
|
| | | <P STYLE="font-weight: normal">When developing code, it is a common
|
| | | precaution to substitute the error checking type, then drop in the
|
| | | normal type for release if the extra performance is required.</P>
|
| | | <HR>
|
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P>
|
| | | <UL>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect0" NAME="toc0">Name</A>
|
| | | </P>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect1" NAME="toc1">Synopsis</A>
|
| | | </P>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect2" NAME="toc2">Description</A>
|
| | | </P>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect3" NAME="toc3">Return
|
| | | Value</A> |
| | | </P>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect5" NAME="toc5">Author</A>
|
| | | </P>
|
| | | <LI><P STYLE="margin-bottom: 0in"><A HREF="#sect6" NAME="toc6">See
|
| | | Also</A></P>
|
| | | <LI><P><A HREF="#sect7" NAME="toc7">Notes</A></P>
|
| | | </UL>
|
| | | </BODY>
|
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_MUTEXATTR_GETPSHARED"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;23480600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18381800"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_mutexattr_getpshared, pthread_mutexattr_setpshared - get |
| | | and set the process-shared attribute |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_mutexattr_getpshared(const pthread_mutexattr_t * |
| | | restrict</B> <I>attr</I><B>, int *restrict</B> <I>pshared</I><B>); |
| | | <BR>int pthread_mutexattr_setpshared(pthread_mutexattr_t *</B><I>attr</I><B>, |
| | | int</B> <I>pshared</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_mutexattr_getpshared</B> function shall obtain the |
| | | value of the <I>process-shared</I> attribute from the attributes |
| | | object referenced by <I>attr</I>. The <B>pthread_mutexattr_setpshared</B> |
| | | function shall set the <I>process-shared</I> attribute in an |
| | | initialized attributes object referenced by <I>attr</I>. |
| | | </P> |
| | | <P>The <I>process-shared</I> attribute is set to |
| | | <B>PTHREAD_PROCESS_SHARED</B> to permit a mutex to be operated upon |
| | | by any thread that has access to the memory where the mutex is |
| | | allocated, even if the mutex is allocated in memory that is shared by |
| | | multiple processes. If the <I>process-shared</I> attribute is |
| | | <B>PTHREAD_PROCESS_PRIVATE</B>, the mutex shall only be operated upon |
| | | by threads created within the same process as the thread that |
| | | initialized the mutex; if threads of differing processes attempt to |
| | | operate on such a mutex, the behavior is undefined. The default value |
| | | of the attribute shall be <B>PTHREAD_PROCESS_PRIVATE</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented but |
| | | the process shared option is not supported.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, <B>pthread_mutexattr_setpshared</B> |
| | | shall return zero; otherwise, an error number shall be returned to |
| | | indicate the error. |
| | | </P> |
| | | <P>Upon successful completion, <B>pthread_mutexattr_getpshared</B> |
| | | shall return zero and store the value of the <I>process-shared</I> |
| | | attribute of <I>attr</I> into the object referenced by the <I>pshared</I> |
| | | parameter. Otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_mutexattr_getpshared</B> and |
| | | <B>pthread_mutexattr_setpshared</B> functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_mutexattr_setpshared</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the attribute is outside the range of |
| | | legal values for that attribute. |
| | | </DD><DT> |
| | | <B>ENOTSUP</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the attribute is PTHREAD_PROCESS_SHARED. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_cond_init.html"><B>pthread_cond_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> <B>,</B> |
| | | <A HREF="pthread_mutex_init.html"><B>pthread_mutex_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_mutexattr_init.html"><B>pthread_mutexattr_destroy</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_NUM_PROCESSORS_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;21514100"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_num_processors_np – get the |
| | | number of processors (CPUs) in use by the process</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_num_processors_np(void);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_num_processors_np </B>returns the number of processors |
| | | in the system. This implementation actually returns the number of |
| | | processors available to the process, which can be a lower number than |
| | | the system's number, depending on the process's affinity mask.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4"><FONT COLOR="#000080">Return Value</FONT></A></H2> |
| | | <P><B>pthread_num_processors_np</B> returns the number of processors |
| | | currently available to the process.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_ONCE(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050603;463100"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_once - once-only initialization |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>pthread_once_t </B><I>once_control</I> <B>= PTHREAD_ONCE_INIT;</B> |
| | | </P> |
| | | <P><B>int pthread_once(pthread_once_t *</B><I>once_control</I><B>, |
| | | void (*</B><I>init_routine</I><B>) (void));</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The purpose of <B>pthread_once</B> is to ensure that a piece of |
| | | initialization code is executed at most once. The <I>once_control</I> |
| | | argument points to a static or extern variable statically initialized |
| | | to <B>PTHREAD_ONCE_INIT</B>. |
| | | </P> |
| | | <P>The first time <B>pthread_once</B> is called with a given |
| | | <I>once_control</I> argument, it calls <I>init_routine</I> with no |
| | | argument and changes the value of the <I>once_control</I> variable to |
| | | record that initialization has been performed. Subsequent calls to |
| | | <B>pthread_once</B> with the same <B>once_control</B> argument do |
| | | nothing. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>While <B>pthread_once</B> is not a cancellation point, |
| | | <I>init_routine</I> can be. The effect on <I>once_control</I> of a |
| | | cancellation inside the <I>init_routine</I> is to leave it as if |
| | | <B>pthread_once</B> had not been called by the cancelled thread.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Return Value</A></H2> |
| | | <P STYLE="text-decoration: none"><FONT COLOR="#000000"><B>pthread_once</B> |
| | | returns 0 on success, or an error code on failure.</FONT></P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>The <B>pthread_once</B> function returns the following error code |
| | | on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm"> |
| | | The once_control or init_routine parameter is NULL.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_DESTROY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;10211800"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18563400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_destroy, pthread_rwlock_init - destroy and |
| | | initialize a read-write lock object |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>pthread_wrlock_t </B><I>rwlock</I> <B>= |
| | | PTHREAD_RWLOCK_INITIALIZER;</B></P> |
| | | <P><B>int pthread_rwlock_destroy(pthread_rwlock_t *</B><I>rwlock</I><B>); |
| | | <BR>int pthread_rwlock_init(pthread_rwlock_t *restrict</B> <I>rwlock</I><B>, |
| | | const pthread_rwlockattr_t *restrict</B> <I>attr</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_destroy</B> function shall destroy the |
| | | read-write lock object referenced by <I>rwlock</I> and release any |
| | | resources used by the lock. The effect of subsequent use of the lock |
| | | is undefined until the lock is reinitialized by another call to |
| | | <B>pthread_rwlock_init</B>. An implementation may cause |
| | | <B>pthread_rwlock_destroy</B> to set the object referenced by <I>rwlock</I> |
| | | to an invalid value. Results are undefined if <B>pthread_rwlock_destroy</B> |
| | | is called when any thread holds <I>rwlock</I>. Attempting to destroy |
| | | an uninitialized read-write lock results in undefined behavior. |
| | | </P> |
| | | <P>The <B>pthread_rwlock_init</B> function shall allocate any |
| | | resources required to use the read-write lock referenced by <I>rwlock</I> |
| | | and initializes the lock to an unlocked state with attributes |
| | | referenced by <I>attr</I>. If <I>attr</I> is NULL, the default |
| | | read-write lock attributes shall be used; the effect is the same as |
| | | passing the address of a default read-write lock attributes object. |
| | | Once initialized, the lock can be used any number of times without |
| | | being reinitialized. Results are undefined if <B>pthread_rwlock_init</B> |
| | | is called specifying an already initialized read-write lock. Results |
| | | are undefined if a read-write lock is used without first being |
| | | initialized. |
| | | </P> |
| | | <P>If the <B>pthread_rwlock_init</B> function fails, <I>rwlock</I> |
| | | shall not be initialized and the contents of <I>rwlock</I> are |
| | | undefined. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> supports statically initialized <I>rwlock</I> |
| | | objects using <B>PTHREAD_RWLOCK_INITIALIZER</B>. <SPAN STYLE="font-weight: medium"> |
| | | An application should still call <B>pthread_rwlock_destroy</B> at |
| | | some point to ensure that any resources consumed by the read/write |
| | | lock are released.</SPAN></P> |
| | | <P>Only the object referenced by <I>rwlock</I> may be used for |
| | | performing synchronization. The result of referring to copies of that |
| | | object in calls to <B>pthread_rwlock_destroy</B> , |
| | | <B>pthread_rwlock_rdlock</B> , <B>pthread_rwlock_timedrdlock</B> , |
| | | <B>pthread_rwlock_timedwrlock</B> , <B>pthread_rwlock_tryrdlock</B> , |
| | | <B>pthread_rwlock_trywrlock</B> , <B>pthread_rwlock_unlock</B> , or |
| | | <B>pthread_rwlock_wrlock</B> is undefined. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_rwlock_destroy</B> and |
| | | <B>pthread_rwlock_init</B> functions shall return zero; otherwise, an |
| | | error number shall be returned to indicate the error. |
| | | </P> |
| | | <P>The [EBUSY] and [EINVAL] error checks, if implemented, act as if |
| | | they were performed immediately at the beginning of processing for |
| | | the function and caused an error return prior to modifying the state |
| | | of the read-write lock specified by <I>rwlock</I>. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_destroy</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD> |
| | | The implementation has detected an attempt to destroy the object |
| | | referenced by <I>rwlock</I> while it is locked. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>rwlock</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_init</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EAGAIN</B> |
| | | </DT><DD> |
| | | The system lacked the necessary resources (other than memory) to |
| | | initialize another read-write lock. |
| | | </DD><DT> |
| | | <B>ENOMEM</B> |
| | | </DT><DD> |
| | | Insufficient memory exists to initialize the read-write lock. |
| | | </DD><DD STYLE="margin-left: 0cm; margin-bottom: 0.5cm"> |
| | | <BR><BR> |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_init</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using these and related read-write lock functions may |
| | | be subject to priority inversion, as discussed in the Base |
| | | Definitions volume of IEEE Std 1003.1-2001, Section 3.285, |
| | | Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_RDLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;10352600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12554200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_rdlock, pthread_rwlock_tryrdlock - lock a |
| | | read-write lock object for reading |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_rwlock_rdlock(pthread_rwlock_t <I>*</I></B><I>rwlock</I><B>); |
| | | <BR></B>i<B>nt pthread_rwlock_tryrdlock(pthread_rwlock_t <I>*</I></B><I>rwlock</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_rdlock</B> function shall apply a read lock |
| | | to the read-write lock referenced by <I>rwlock</I>. The calling |
| | | thread acquires the read lock if a writer does not hold the lock and |
| | | there are no writers blocked on the lock. |
| | | </P> |
| | | <P><B>Pthreads-win32</B> does not prefer either writers or readers in |
| | | acquiring the lock – all threads enter a single prioritised FIFO |
| | | queue. While this may not be optimally efficient for some |
| | | applications, it does ensure that one type does not starve the other.</P> |
| | | <P>A thread may hold multiple concurrent read locks on <I>rwlock</I> |
| | | (that is, successfully call the <B>pthread_rwlock_rdlock</B> function |
| | | <I>n</I> times). If so, the application shall ensure that the thread |
| | | performs matching unlocks (that is, it calls the |
| | | <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | function <I>n</I> times). |
| | | </P> |
| | | <P>The <B>pthread_rwlock_tryrdlock</B> function shall apply a read |
| | | lock as in the <B>pthread_rwlock_rdlock</B> function, with the |
| | | exception that the function shall fail if the equivalent |
| | | <B>pthread_rwlock_rdlock</B> call would have blocked the calling |
| | | thread. In no case shall the <B>pthread_rwlock_tryrdlock</B> function |
| | | ever block; it always either acquires the lock or fails and returns |
| | | immediately. |
| | | </P> |
| | | <P>Results are undefined if any of these functions are called with an |
| | | uninitialized read-write lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> does not detect deadlock if the thread already |
| | | owns the lock for writing.</P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_rwlock_rdlock</B> function shall |
| | | return zero; otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <P>The <B>pthread_rwlock_tryrdlock</B> function shall return zero if |
| | | the lock for reading on the read-write lock object referenced by |
| | | <I>rwlock</I> is acquired. Otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_tryrdlock</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The read-write lock could not be acquired for reading because a |
| | | writer holds the lock or a writer with the appropriate priority was |
| | | blocked on it. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_rdlock</B> and <B>pthread_rwlock_tryrdlock</B> |
| | | functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD> |
| | | The value specified by <I>rwlock</I> does not refer to an |
| | | initialized read-write lock object. |
| | | </DD><DT> |
| | | <B>EAGAIN</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The read lock could not be acquired because the maximum number of |
| | | read locks for <I>rwlock</I> has been exceeded. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using these functions may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_TIMEDRDLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;11101700"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12560000"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_timedrdlock - lock a read-write lock for reading |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> <BR></B>#include <time.h> |
| | | </P> |
| | | <P><B>int pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict</B> |
| | | <I>rwlock</I><B>, const struct timespec *restrict</B> <I>abs_timeout</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_timedrdlock</B> function shall apply a read |
| | | lock to the read-write lock referenced by <I>rwlock</I> as in the |
| | | <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | function. However, if the lock cannot be acquired without waiting for |
| | | other threads to unlock the lock, this wait shall be terminated when |
| | | the specified timeout expires. The timeout shall expire when the |
| | | absolute time specified by <I>abs_timeout</I> passes, as measured by |
| | | the clock on which timeouts are based (that is, when the value of |
| | | that clock equals or exceeds <I>abs_timeout</I>), or if the absolute |
| | | time specified by <I>abs_timeout</I> has already been passed at the |
| | | time of the call. |
| | | </P> |
| | | <P>The <B>timespec</B> data type is defined in the <I><time.h></I> |
| | | header. Under no circumstances shall the function fail with a timeout |
| | | if the lock can be acquired immediately. The validity of the |
| | | <I>abs_timeout</I> parameter need not be checked if the lock can be |
| | | immediately acquired. |
| | | </P> |
| | | <P>The calling thread may deadlock if at the time the call is made it |
| | | holds a write lock on <I>rwlock</I>. The results are undefined if |
| | | this function is called with an uninitialized read-write lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>The <B>pthread_rwlock_timedrdlock</B> function shall return zero |
| | | if the lock for reading on the read-write lock object referenced by |
| | | <I>rwlock</I> is acquired. Otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_timedrdlock</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>ETIMEDOUT</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The lock could not be acquired before the specified timeout expired. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_timedrdlock</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EAGAIN</B> |
| | | </DT><DD> |
| | | The read lock could not be acquired because the maximum number of |
| | | read locks for lock would be exceeded. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>rwlock</I> does not refer to an |
| | | initialized read-write lock object, or the <I>abs_timeout</I> |
| | | nanosecond value is less than zero or greater than or equal to 1000 |
| | | million. |
| | | </DD></DL> |
| | | <P> |
| | | This function shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using this function may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I>, <I><time.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_TIMEDWRLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;11172800"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12561600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_timedwrlock - lock a read-write lock for writing |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> <BR></B>#include <time.h> |
| | | </P> |
| | | <P><B>int pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict</B> |
| | | <I>rwlock</I><B>, const struct timespec *restrict</B> <I>abs_timeout</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_timedwrlock</B> function shall apply a write |
| | | lock to the read-write lock referenced by <I>rwlock</I> as in the |
| | | <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | function. However, if the lock cannot be acquired without waiting for |
| | | other threads to unlock the lock, this wait shall be terminated when |
| | | the specified timeout expires. The timeout shall expire when the |
| | | absolute time specified by <I>abs_timeout</I> passes, as measured by |
| | | the clock on which timeouts are based (that is, when the value of |
| | | that clock equals or exceeds <I>abs_timeout</I>), or if the absolute |
| | | time specified by <I>abs_timeout</I> has already been passed at the |
| | | time of the call. |
| | | </P> |
| | | <P>The <B>timespec</B> data type is defined in the <I><time.h></I> |
| | | header. Under no circumstances shall the function fail with a timeout |
| | | if the lock can be acquired immediately. The validity of the |
| | | <I>abs_timeout</I> parameter need not be checked if the lock can be |
| | | immediately acquired. |
| | | </P> |
| | | <P>The calling thread may deadlock if at the time the call is made it |
| | | holds the read-write lock. The results are undefined if this function |
| | | is called with an uninitialized read-write lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>The <B>pthread_rwlock_timedwrlock</B> function shall return zero |
| | | if the lock for writing on the read-write lock object referenced by |
| | | <I>rwlock</I> is acquired. Otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_timedwrlock</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>ETIMEDOUT</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The lock could not be acquired before the specified timeout expired. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_timedwrlock</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by rwlock does not refer to an initialized |
| | | read-write lock object, or the <I>abs_timeout</I> nanosecond value |
| | | is less than zero or greater than or equal to 1000 million. |
| | | </DD></DL> |
| | | <P> |
| | | This function shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using this function may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I>, <I><time.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_UNLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;11291100"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12562700"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_unlock - unlock a read-write lock object |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P>in<B>t pthread_rwlock_unlock(pthread_rwlock_t <I>*</I></B><I>rwlock</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_unlock</B> function shall release a lock |
| | | held on the read-write lock object referenced by <I>rwlock</I>. |
| | | Results are undefined if the read-write lock <I>rwlock</I> is not |
| | | held by the calling thread. |
| | | </P> |
| | | <P>If this function is called to release a read lock from the |
| | | read-write lock object and there are other read locks currently held |
| | | on this read-write lock object, the read-write lock object remains in |
| | | the read locked state. If this function releases the last read lock |
| | | for this read-write lock object, the read-write lock object shall be |
| | | put in the unlocked state with no owners. |
| | | </P> |
| | | <P>If this function is called to release a write lock for this |
| | | read-write lock object, the read-write lock object shall be put in |
| | | the unlocked state. |
| | | </P> |
| | | <P><B>Pthreads-win32</B> does not prefer either writers or readers in |
| | | acquiring the lock – all threads enter a single prioritised FIFO |
| | | queue. While this may not be optimally efficient for some |
| | | applications, it does ensure that one type does not starve the other.</P> |
| | | <P>Results are undefined if any of these functions are called with an |
| | | uninitialized read-write lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_rwlock_unlock</B> function shall |
| | | return zero; otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_unlock</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD> |
| | | The value specified by <I>rwlock</I> does not refer to an |
| | | initialized read-write lock object. |
| | | </DD><DD STYLE="margin-left: 0cm; margin-bottom: 0.5cm"> |
| | | <BR><BR> |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_unlock</B> function shall not return an error |
| | | code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_trywrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_wrlock.html"><B>pthread_rwlock_wrlock</B>(3)</A> |
| | | , the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCK_TRYWRLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;11221900"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12563800"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlock_trywrlock, pthread_rwlock_wrlock - lock a |
| | | read-write lock object for writing |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_rwlock_trywrlock(pthread_rwlock_t <I>*</I></B><I>rwlock</I><B>); |
| | | <BR>int pthread_rwlock_wrlock(pthread_rwlock_t <I>*</I></B><I>rwlock</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlock_trywrlock</B> function shall apply a write |
| | | lock like the <B>pthread_rwlock_wrlock</B> function, with the |
| | | exception that the function shall fail if any thread currently holds |
| | | <I>rwlock</I> (for reading or writing). |
| | | </P> |
| | | <P>The <B>pthread_rwlock_wrlock</B> function shall apply a write lock |
| | | to the read-write lock referenced by <I>rwlock</I>. The calling |
| | | thread acquires the write lock if no other thread (reader or writer) |
| | | holds the read-write lock <I>rwlock</I>. Otherwise, the thread shall |
| | | block until it can acquire the lock. The calling thread may deadlock |
| | | if at the time the call is made it holds the read-write lock (whether |
| | | a read or write lock). |
| | | </P> |
| | | <P><B>Pthreads-win32</B> does not prefer either writers or readers in |
| | | acquiring the lock – all threads enter a single prioritised FIFO |
| | | queue. While this may not be optimally efficient for some |
| | | applications, it does ensure that one type does not starve the other.</P> |
| | | <P>Results are undefined if any of these functions are called with an |
| | | uninitialized read-write lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>The <B>pthread_rwlock_trywrlock</B> function shall return zero if |
| | | the lock for writing on the read-write lock object referenced by |
| | | <I>rwlock</I> is acquired. Otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <P>If successful, the <B>pthread_rwlock_wrlock</B> function shall |
| | | return zero; otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlock_trywrlock</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The read-write lock could not be acquired for writing because it was |
| | | already locked for reading or writing. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlock_trywrlock</B> and <B>pthread_rwlock_wrlock</B> |
| | | functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>rwlock</I> does not refer to an |
| | | initialized read-write lock object. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using these functions may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_rdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedrdlock.html"><B>pthread_rwlock_timedrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_timedwrlock.html"><B>pthread_rwlock_timedwrlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_rdlock.html"><B>pthread_rwlock_tryrdlock</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlock_unlock.html"><B>pthread_rwlock_unlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCKATTR_DESTROY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;504000"> |
| | | <META NAME="CHANGED" CONTENT="20050505;18474200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlockattr_destroy, pthread_rwlockattr_init - destroy and |
| | | initialize the read-write lock attributes object |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_rwlockattr_destroy(pthread_rwlockattr_t <I>*</I></B><I>attr</I><B>); |
| | | <BR>int pthread_rwlockattr_init(pthread_rwlockattr_t <I>*</I></B><I>attr</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlockattr_destroy</B> function shall destroy a |
| | | read-write lock attributes object. A destroyed <I>attr</I> attributes |
| | | object can be reinitialized using <B>pthread_rwlockattr_init</B> ; |
| | | the results of otherwise referencing the object after it has been |
| | | destroyed are undefined. An implementation may cause |
| | | <B>pthread_rwlockattr_destroy</B> to set the object referenced by |
| | | <I>attr</I> to an invalid value. |
| | | </P> |
| | | <P>The <B>pthread_rwlockattr_init</B> function shall initialize a |
| | | read-write lock attributes object <I>attr</I> with the default value |
| | | for all of the attributes defined by the implementation. |
| | | </P> |
| | | <P>Results are undefined if <B>pthread_rwlockattr_init</B> is called |
| | | specifying an already initialized <I>attr</I> attributes object. |
| | | </P> |
| | | <P>After a read-write lock attributes object has been used to |
| | | initialize one or more read-write locks, any function affecting the |
| | | attributes object (including destruction) shall not affect any |
| | | previously initialized read-write locks. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_rwlockattr_destroy</B> and |
| | | <B>pthread_rwlockattr_init</B> functions shall return zero; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlockattr_destroy</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlockattr_init</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>ENOMEM</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | Insufficient memory exists to initialize the read-write lock |
| | | attributes object. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlockattr_setpshared.html"><B>pthread_rwlockattr_getpshared</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlockattr_setpshared.html"><B>pthread_rwlockattr_setpshared</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_RWLOCKATTR_GETPSHARED"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;10124400"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12572100"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_rwlockattr_getpshared, pthread_rwlockattr_setpshared - get |
| | | and set the process-shared attribute of the read-write lock |
| | | attributes object |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * |
| | | restrict </B><I>attr</I><B>, int *restrict</B> <I>pshared</I><B>); |
| | | <BR>int pthread_rwlockattr_setpshared(pthread_rwlockattr_t <I>*</I></B><I>attr</I><B>, |
| | | int</B> <I>pshared</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_rwlockattr_getpshared</B> function shall obtain the |
| | | value of the <I>process-shared</I> attribute from the initialized |
| | | attributes object referenced by <I>attr</I>. The |
| | | <B>pthread_rwlockattr_setpshared</B> function shall set the |
| | | <I>process-shared</I> attribute in an initialized attributes object |
| | | referenced by <I>attr</I>. |
| | | </P> |
| | | <P>The <I>process-shared</I> attribute shall be set to |
| | | <B>PTHREAD_PROCESS_SHARED</B> to permit a read-write lock to be |
| | | operated upon by any thread that has access to the memory where the |
| | | read-write lock is allocated, even if the read-write lock is |
| | | allocated in memory that is shared by multiple processes. If the |
| | | <I>process-shared</I> attribute is <B>PTHREAD_PROCESS_PRIVATE</B>, |
| | | the read-write lock shall only be operated upon by threads created |
| | | within the same process as the thread that initialized the read-write |
| | | lock; if threads of differing processes attempt to operate on such a |
| | | read-write lock, the behavior is undefined. The default value of the |
| | | <I>process-shared</I> attribute shall be <B>PTHREAD_PROCESS_PRIVATE</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines are implemented but |
| | | they do not support the process shared option.</P> |
| | | <P>Additional attributes, their default values, and the names of the |
| | | associated functions to get and set those attribute values are |
| | | implementation-defined. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_READER_WRITER_LOCKS</B> in |
| | | pthread.h as 200112L to indicate that the reader/writer routines are |
| | | implemented and may be used.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, the <B>pthread_rwlockattr_getpshared</B> |
| | | function shall return zero and store the value of the <I>process-shared</I> |
| | | attribute of <I>attr</I> into the object referenced by the <I>pshared</I> |
| | | parameter. Otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <P>If successful, the <B>pthread_rwlockattr_setpshared</B> function |
| | | shall return zero; otherwise, an error number shall be returned to |
| | | indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_rwlockattr_getpshared</B> and |
| | | <B>pthread_rwlockattr_setpshared</B> functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>attr</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_rwlockattr_setpshared</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the attribute is outside the range of |
| | | legal values for that attribute. |
| | | </DD><DT> |
| | | <B>ENOTSUP</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The new value specified for the attribute is <B>PTHREAD_PROCESS_SHARED</B>. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_rwlock_init.html"><B>pthread_rwlock_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlockattr_init.html"><B>pthread_rwlockattr_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_rwlockattr_init.html"><B>pthread_rwlockattr_init</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_SELF(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;11361600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;11575700"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_self - return identifier of current thread |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>pthread_t pthread_self(void);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_self</B> return the thread identifier for the calling |
| | | thread. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> also provides support for <B>Win32</B> native |
| | | threads to interact with POSIX threads through the pthreads API. |
| | | Whereas all threads created via a call to pthread_create have a POSIX |
| | | thread ID and thread state, the library ensures that any Win32 native |
| | | threads that interact through the Pthreads API also generate a POSIX |
| | | thread ID and thread state when and if necessary. This provides full |
| | | <SPAN LANG="en-GB">reciprocity</SPAN> between Win32 and POSIX |
| | | threads. Win32 native threads that generate a POSIX thread ID and |
| | | state are treated by the library as having been created with the |
| | | <B>PTHREAD_CREATE_DETACHED</B> attribute.</P> |
| | | <P>Any Win32 native thread may call <B>pthread_self</B> directly to |
| | | return it's POSIX thread identifier. The ID and state will be |
| | | generated if it does not already exist. Win32 native threads do not |
| | | need to call <B>pthread_self</B> before calling Pthreads-w32 routines |
| | | unless that routine requires a pthread_t parameter.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4">See Also</A></H2> |
| | | <P><A HREF="pthread_equal.html"><B>pthread_equal</B>(3)</A> , |
| | | <A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> , |
| | | <A HREF="pthread_detach.html"><B>pthread_detach</B>(3)</A> , |
| | | <A HREF="pthread_setschedparam.html"><B>pthread_setschedparam</B>(3)</A> |
| | | , <A HREF="pthread_setschedparam.html"><B>pthread_getschedparam</B>(3)</A> |
| | | . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect4" NAME="toc4">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CANCEL(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;12090500"> |
| | | <META NAME="CHANGED" CONTENT="20050504;16361300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, |
| | | pthread_testcancel - thread cancellation |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_cancel(pthread_t </B><I>thread</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcancelstate(int </B><I>state</I><B>, int |
| | | *</B><I>oldstate</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcanceltype(int </B><I>type</I><B>, int |
| | | *</B><I>oldtype</I><B>);</B> |
| | | </P> |
| | | <P><B>void pthread_testcancel(void);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Cancellation is the mechanism by which a thread can terminate the |
| | | execution of another thread. More precisely, a thread can send a |
| | | cancellation request to another thread. Depending on its settings, |
| | | the target thread can then either ignore the request, honor it |
| | | immediately, or defer it until it reaches a cancellation point. |
| | | </P> |
| | | <P>When a thread eventually honors a cancellation request, it |
| | | performs as if <B>pthread_exit(PTHREAD_CANCELED)</B> has been called |
| | | at that point: all cleanup handlers are executed in reverse order, |
| | | destructor functions for thread-specific data are called, and finally |
| | | the thread stops executing with the return value <B>PTHREAD_CANCELED</B>. |
| | | See <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> for more |
| | | information. |
| | | </P> |
| | | <P><B>pthread_cancel</B> sends a cancellation request to the thread |
| | | denoted by the <I>thread</I> argument. |
| | | </P> |
| | | <P><B>pthread_setcancelstate</B> changes the cancellation state for |
| | | the calling thread -- that is, whether cancellation requests are |
| | | ignored or not. The <I>state</I> argument is the new cancellation |
| | | state: either <B>PTHREAD_CANCEL_ENABLE</B> to enable cancellation, or |
| | | <B>PTHREAD_CANCEL_DISABLE</B> to disable cancellation (cancellation |
| | | requests are ignored). If <I>oldstate</I> is not <B>NULL</B>, the |
| | | previous cancellation state is stored in the location pointed to by |
| | | <I>oldstate</I>, and can thus be restored later by another call to |
| | | <B>pthread_setcancelstate</B>. |
| | | </P> |
| | | <P><B>pthread_setcanceltype</B> changes the type of responses to |
| | | cancellation requests for the calling thread: asynchronous |
| | | (immediate) or deferred. The <I>type</I> argument is the new |
| | | cancellation type: either <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> to |
| | | cancel the calling thread as soon as the cancellation request is |
| | | received, or <B>PTHREAD_CANCEL_DEFERRED</B> to keep the cancellation |
| | | request pending until the next cancellation point. If <I>oldtype</I> |
| | | is not <B>NULL</B>, the previous cancellation state is stored in the |
| | | location pointed to by <I>oldtype</I>, and can thus be restored later |
| | | by another call to <B>pthread_setcanceltype</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> provides two levels of support for |
| | | <B>PTHREAD_CANCEL_ASYNCHRONOUS</B>: full and partial. Full support |
| | | requires an additional DLL and driver be installed on the Windows |
| | | system (see the See Also section below) that allows blocked threads |
| | | to be cancelled immediately. Partial support means that the target |
| | | thread will not cancel until it resumes execution naturally. Partial |
| | | support is provided if either the DLL or the driver are not |
| | | automatically detected by the pthreads-w32 library at run-time.</P> |
| | | <P>Threads are always created by <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | with cancellation enabled and deferred. That is, the initial |
| | | cancellation state is <B>PTHREAD_CANCEL_ENABLE</B> and the initial |
| | | type is <B>PTHREAD_CANCEL_DEFERRED</B>. |
| | | </P> |
| | | <P>Cancellation points are those points in the program execution |
| | | where a test for pending cancellation requests is performed and |
| | | cancellation is executed if positive. The following POSIX threads |
| | | functions are cancellation points: |
| | | </P> |
| | | <P><A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_wait.html"><B>pthread_cond_wait</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_timedwait.html"><B>pthread_cond_timedwait</B>(3)</A> |
| | | <BR><A HREF="pthread_testcancel.html"><B>pthread_testcancel</B>(3)</A> |
| | | <BR><A HREF="sem_wait.html"><B>sem_wait</B>(3)</A> <BR><A HREF="sem_timedwait.html"><B>sem_timedwait</B>(3)</A> |
| | | <BR><A HREF="sigwait.html"><B>sigwait</B>(3)</A> (not supported under |
| | | <B>Pthreads-w32</B>)</P> |
| | | <P><B>Pthreads-w32</B> provides two functions to enable additional |
| | | cancellation points to be created in user functions that block on |
| | | Win32 HANDLEs:</P> |
| | | <P><A HREF="pthreadCancelableWait.html">pthreadCancelableWait()</A> |
| | | <BR><A HREF="pthreadCancelableTimedWait.html">pthreadCancelableTimedWait()</A></P> |
| | | <P>All other POSIX threads functions are guaranteed not to be |
| | | cancellation points. That is, they never perform cancellation in |
| | | deferred cancellation mode. |
| | | </P> |
| | | <P><B>pthread_testcancel</B> does nothing except testing for pending |
| | | cancellation and executing it. Its purpose is to introduce explicit |
| | | checks for cancellation in long sequences of code that do not call |
| | | cancellation point functions otherwise. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P><B>pthread_cancel</B>, <B>pthread_setcancelstate</B> and |
| | | <B>pthread_setcanceltype</B> return 0 on success and a non-zero error |
| | | code on error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P><B>pthread_cancel</B> returns the following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | no thread could be found corresponding to that specified by the |
| | | <I>thread</I> ID. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | <B>pthread_setcancelstate</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>state</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_ENABLE</B> nor <B>PTHREAD_CANCEL_DISABLE</B> |
| | | </BLOCKQUOTE> |
| | | <P><B>pthread_setcanceltype</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>type</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_DEFERRED</B> nor <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> |
| | | </BLOCKQUOTE> |
| | | <H2><A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , |
| | | <A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_push</B>(3)</A> |
| | | , <A HREF="pthread_cleanup_pop.html"><B>pthread_cleanup_pop</B>(3)</A> |
| | | , Pthreads-w32 package README file 'Prerequisites' section. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Bugs</A></H2> |
| | | <P>POSIX specifies that a number of system calls (basically, all |
| | | system calls that may block, such as <A HREF="read.html"><B>read</B>(2)</A> |
| | | , <A HREF="write.html"><B>write</B>(2)</A> , <A HREF="wait.html"><B>wait</B>(2)</A> |
| | | , etc.) and library functions that may call these system calls (e.g. |
| | | <A HREF="fprintf.html"><B>fprintf</B>(3)</A> ) are cancellation |
| | | points. <B>Pthreads-win32</B> is not integrated enough with the C |
| | | library to implement this, and thus none of the C library functions |
| | | is a cancellation point. |
| | | </P> |
| | | <P>A workaround for these calls is to temporarily switch to |
| | | asynchronous cancellation (assuming full asynchronous cancellation |
| | | support is installed). So, checking for cancellation during a <B>read</B> |
| | | system call, for instance, can be achieved as follows: |
| | | </P> |
| | | <BLOCKQUOTE><BR><BR> |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1cm; margin-right: 1cm">pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldCancelType); |
| | | read(fd, buffer, length); |
| | | pthread_setcanceltype(oldCancelType, NULL);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE><A NAME="toc"></A><B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE><A HREF="#sect7" NAME="toc7">Bugs</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_CANCEL(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;12090500"> |
| | | <META NAME="CHANGED" CONTENT="20050504;16362800"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_cancel, pthread_setcancelstate, pthread_setcanceltype, |
| | | pthread_testcancel - thread cancellation |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_cancel(pthread_t </B><I>thread</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcancelstate(int </B><I>state</I><B>, int |
| | | *</B><I>oldstate</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_setcanceltype(int </B><I>type</I><B>, int |
| | | *</B><I>oldtype</I><B>);</B> |
| | | </P> |
| | | <P><B>void pthread_testcancel(void);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Cancellation is the mechanism by which a thread can terminate the |
| | | execution of another thread. More precisely, a thread can send a |
| | | cancellation request to another thread. Depending on its settings, |
| | | the target thread can then either ignore the request, honor it |
| | | immediately, or defer it until it reaches a cancellation point. |
| | | </P> |
| | | <P>When a thread eventually honors a cancellation request, it |
| | | performs as if <B>pthread_exit(PTHREAD_CANCELED)</B> has been called |
| | | at that point: all cleanup handlers are executed in reverse order, |
| | | destructor functions for thread-specific data are called, and finally |
| | | the thread stops executing with the return value <B>PTHREAD_CANCELED</B>. |
| | | See <A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> for more |
| | | information. |
| | | </P> |
| | | <P><B>pthread_cancel</B> sends a cancellation request to the thread |
| | | denoted by the <I>thread</I> argument. |
| | | </P> |
| | | <P><B>pthread_setcancelstate</B> changes the cancellation state for |
| | | the calling thread -- that is, whether cancellation requests are |
| | | ignored or not. The <I>state</I> argument is the new cancellation |
| | | state: either <B>PTHREAD_CANCEL_ENABLE</B> to enable cancellation, or |
| | | <B>PTHREAD_CANCEL_DISABLE</B> to disable cancellation (cancellation |
| | | requests are ignored). If <I>oldstate</I> is not <B>NULL</B>, the |
| | | previous cancellation state is stored in the location pointed to by |
| | | <I>oldstate</I>, and can thus be restored later by another call to |
| | | <B>pthread_setcancelstate</B>. |
| | | </P> |
| | | <P><B>pthread_setcanceltype</B> changes the type of responses to |
| | | cancellation requests for the calling thread: asynchronous |
| | | (immediate) or deferred. The <I>type</I> argument is the new |
| | | cancellation type: either <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> to |
| | | cancel the calling thread as soon as the cancellation request is |
| | | received, or <B>PTHREAD_CANCEL_DEFERRED</B> to keep the cancellation |
| | | request pending until the next cancellation point. If <I>oldtype</I> |
| | | is not <B>NULL</B>, the previous cancellation state is stored in the |
| | | location pointed to by <I>oldtype</I>, and can thus be restored later |
| | | by another call to <B>pthread_setcanceltype</B>. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> provides two levels of support for |
| | | <B>PTHREAD_CANCEL_ASYNCHRONOUS</B>: full and partial. Full support |
| | | requires an additional DLL and driver be installed on the Windows |
| | | system (see the See Also section below) that allows blocked threads |
| | | to be cancelled immediately. Partial support means that the target |
| | | thread will not cancel until it resumes execution naturally. Partial |
| | | support is provided if either the DLL or the driver are not |
| | | automatically detected by the pthreads-w32 library at run-time.</P> |
| | | <P>Threads are always created by <A HREF="pthread_create.html"><B>pthread_create</B>(3)</A> |
| | | with cancellation enabled and deferred. That is, the initial |
| | | cancellation state is <B>PTHREAD_CANCEL_ENABLE</B> and the initial |
| | | type is <B>PTHREAD_CANCEL_DEFERRED</B>. |
| | | </P> |
| | | <P>Cancellation points are those points in the program execution |
| | | where a test for pending cancellation requests is performed and |
| | | cancellation is executed if positive. The following POSIX threads |
| | | functions are cancellation points: |
| | | </P> |
| | | <P><A HREF="pthread_join.html"><B>pthread_join</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_wait.html"><B>pthread_cond_wait</B>(3)</A> |
| | | <BR><A HREF="pthread_cond_timedwait.html"><B>pthread_cond_timedwait</B>(3)</A> |
| | | <BR><A HREF="pthread_testcancel.html"><B>pthread_testcancel</B>(3)</A> |
| | | <BR><A HREF="sem_wait.html"><B>sem_wait</B>(3)</A> <BR><A HREF="sem_timedwait.html"><B>sem_timedwait</B>(3)</A> |
| | | <BR><A HREF="sigwait.html"><B>sigwait</B>(3)</A> (not supported under |
| | | <B>Pthreads-w32</B>)</P> |
| | | <P><B>Pthreads-w32</B> provides two functions to enable additional |
| | | cancellation points to be created in user functions that block on |
| | | Win32 HANDLEs:</P> |
| | | <P><A HREF="pthreadCancelableWait.html">pthreadCancelableWait()</A> |
| | | <BR><A HREF="pthreadCancelableTimedWait.html">pthreadCancelableTimedWait()</A></P> |
| | | <P>All other POSIX threads functions are guaranteed not to be |
| | | cancellation points. That is, they never perform cancellation in |
| | | deferred cancellation mode. |
| | | </P> |
| | | <P><B>pthread_testcancel</B> does nothing except testing for pending |
| | | cancellation and executing it. Its purpose is to introduce explicit |
| | | checks for cancellation in long sequences of code that do not call |
| | | cancellation point functions otherwise. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P><B>pthread_cancel</B>, <B>pthread_setcancelstate</B> and |
| | | <B>pthread_setcanceltype</B> return 0 on success and a non-zero error |
| | | code on error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P><B>pthread_cancel</B> returns the following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | no thread could be found corresponding to that specified by the |
| | | <I>thread</I> ID. |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | <B>pthread_setcancelstate</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>state</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_ENABLE</B> nor <B>PTHREAD_CANCEL_DISABLE</B> |
| | | </BLOCKQUOTE> |
| | | <P><B>pthread_setcanceltype</B> returns the following error code on |
| | | error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>type</I> argument is not |
| | | </DD></DL> |
| | | </DL> |
| | | <BLOCKQUOTE> |
| | | <B>PTHREAD_CANCEL_DEFERRED</B> nor <B>PTHREAD_CANCEL_ASYNCHRONOUS</B> |
| | | </BLOCKQUOTE> |
| | | <H2><A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="pthread_exit.html"><B>pthread_exit</B>(3)</A> , |
| | | <A HREF="pthread_cleanup_push.html"><B>pthread_cleanup_push</B>(3)</A> |
| | | , <A HREF="pthread_cleanup_pop.html"><B>pthread_cleanup_pop</B>(3)</A> |
| | | , Pthreads-w32 package README file 'Prerequisites' section. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Bugs</A></H2> |
| | | <P>POSIX specifies that a number of system calls (basically, all |
| | | system calls that may block, such as <A HREF="read.html"><B>read</B>(2)</A> |
| | | , <A HREF="write.html"><B>write</B>(2)</A> , <A HREF="wait.html"><B>wait</B>(2)</A> |
| | | , etc.) and library functions that may call these system calls (e.g. |
| | | <A HREF="fprintf.html"><B>fprintf</B>(3)</A> ) are cancellation |
| | | points. <B>Pthreads-win32</B> is not integrated enough with the C |
| | | library to implement this, and thus none of the C library functions |
| | | is a cancellation point. |
| | | </P> |
| | | <P>A workaround for these calls is to temporarily switch to |
| | | asynchronous cancellation (assuming full asynchronous cancellation |
| | | support is installed). So, checking for cancellation during a <B>read</B> |
| | | system call, for instance, can be achieved as follows: |
| | | </P> |
| | | <BLOCKQUOTE><BR><BR> |
| | | </BLOCKQUOTE> |
| | | <PRE STYLE="margin-left: 1cm; margin-right: 1cm">pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldCancelType); |
| | | read(fd, buffer, length); |
| | | pthread_setcanceltype(oldCancelType, NULL);</PRE> |
| | | <HR> |
| | | <BLOCKQUOTE><A NAME="toc"></A><B>Table of Contents</B></BLOCKQUOTE> |
| | | <UL> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">See |
| | | Also</A> |
| | | </BLOCKQUOTE> |
| | | <LI><BLOCKQUOTE><A HREF="#sect7" NAME="toc7">Bugs</A> |
| | | </BLOCKQUOTE> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_GETCONCURRENCY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;19162600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;19223800"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_getconcurrency, pthread_setconcurrency - get and set the |
| | | level of concurrency |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_getconcurrency(void);</B> <BR><B>int |
| | | pthread_setconcurrency(int</B> <I>new_level</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Unbound threads in a process may or may not be required to be |
| | | simultaneously active. By default, the threads implementation ensures |
| | | that a sufficient number of threads are active so that the process |
| | | can continue to make progress. While this conserves system resources, |
| | | it may not produce the most effective level of concurrency. |
| | | </P> |
| | | <P>The <B>pthread_setconcurrency</B> function allows an application |
| | | to inform the threads implementation of its desired concurrency |
| | | level, <I>new_level</I>. The actual level of concurrency provided by |
| | | the implementation as a result of this function call is unspecified. |
| | | </P> |
| | | <P>If <I>new_level</I> is zero, it causes the implementation to |
| | | maintain the concurrency level at its discretion as if |
| | | <B>pthread_setconcurrency</B> had never been called. |
| | | </P> |
| | | <P>The <B>pthread_getconcurrency</B> function shall return the value |
| | | set by a previous call to the <B>pthread_setconcurrency</B> function. |
| | | If the <B>pthread_setconcurrency</B> function was not previously |
| | | called, this function shall return zero to indicate that the |
| | | implementation is maintaining the concurrency level. |
| | | </P> |
| | | <P>A call to <B>pthread_setconcurrency</B> shall inform the |
| | | implementation of its desired concurrency level. The implementation |
| | | shall use this as a hint, not a requirement. |
| | | </P> |
| | | <P>If an implementation does not support multiplexing of user threads |
| | | on top of several kernel-scheduled entities, the |
| | | <B>pthread_setconcurrency</B> and <B>pthread_getconcurrency</B> |
| | | functions are provided for source code compatibility but they shall |
| | | have no effect when called. To maintain the function semantics, the |
| | | <I>new_level</I> parameter is saved when <B>pthread_setconcurrency</B> |
| | | is called so that a subsequent call to <B>pthread_getconcurrency</B> |
| | | shall return the same value. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> provides these routines for source code |
| | | compatibility only, as described in the previous paragraph.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>pthread_setconcurrency</B> function shall |
| | | return zero; otherwise, an error number shall be returned to indicate |
| | | the error. |
| | | </P> |
| | | <P>The <B>pthread_getconcurrency</B> function shall always return the |
| | | concurrency level set by a previous call to <B>pthread_setconcurrency</B> |
| | | . If the <B>pthread_setconcurrency</B> function has never been |
| | | called, <B>pthread_getconcurrency</B> shall return zero. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_setconcurrency</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD> |
| | | The value specified by <I>new_level</I> is negative. |
| | | </DD><DT> |
| | | <B>EAGAIN</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specific by <I>new_level</I> would cause a system resource |
| | | to be exceeded. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Use of these functions changes the state of the underlying |
| | | concurrency upon which the application depends. Library developers |
| | | are advised to not use the <B>pthread_getconcurrency</B> and |
| | | <B>pthread_setconcurrency</B> functions since their use may conflict |
| | | with an applications use of these functions. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P>The Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_SETSCHEDPARAM(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.4 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050504;18110100"> |
| | | <META NAME="CHANGEDBY" CONTENT="Ross Johnson"> |
| | | <META NAME="CHANGED" CONTENT="20080630;22330400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_setschedparam, pthread_getschedparam - control thread |
| | | scheduling |
| | | </P> |
| | | <P>parameters |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>int pthread_setschedparam(pthread_t </B><I>target_thread</I><B>, |
| | | int </B><I>policy</I><B>, const struct sched_param *</B><I>param</I><B>);</B> |
| | | </P> |
| | | <P><B>int pthread_getschedparam(pthread_t </B><I>target_thread</I><B>, |
| | | int *</B><I>policy</I><B>, struct sched_param *</B><I>param</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_setschedparam</B> sets the scheduling parameters for |
| | | the thread <I>target_thread</I> as indicated by <I>policy</I> and |
| | | <I>param</I>. <I>policy</I> can be either <B>SCHED_OTHER</B> |
| | | (regular, non-real-time scheduling), <B>SCHED_RR</B> (real-time, |
| | | round-robin) or <B>SCHED_FIFO</B> (real-time, first-in first-out). |
| | | <I>param</I> specifies the scheduling priority for the two real-time |
| | | policies.</P> |
| | | <P><B>Pthreads-w32</B> only supports SCHED_OTHER and does not support |
| | | the real-time scheduling policies <B>SCHED_RR</B> and <B>SCHED_FIFO.</B> |
| | | </P> |
| | | <P><B>pthread_getschedparam</B> retrieves the scheduling policy and |
| | | scheduling parameters for the thread <I>target_thread</I> and stores |
| | | them in the locations pointed to by <I>policy</I> and <I>param</I>, |
| | | respectively. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P><B>pthread_setschedparam</B> and <B>pthread_getschedparam</B> |
| | | return 0 on success and a non-zero error code on error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>On error, <B>pthread_setschedparam</B> returns the following error |
| | | codes: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ENOTSUP</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>policy</I> is not <B>SCHED_OTHER.</B></DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | One of the arguments is invalid, or the priority value specified by |
| | | <I>param</I> is not valid for the specified policy.</DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | The <I>target_thread</I> is invalid or has already terminated |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | On error, <B>pthread_getschedparam</B> returns the following error |
| | | codes: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ESRCH</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | the <I>target_thread</I> is invalid or has already terminated |
| | | </DD></DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc5" NAME="sect5">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">See Also</A></H2> |
| | | <P><A HREF="sched_setscheduler.html"><B>sched_setscheduler</B>(2)</A> |
| | | , <A HREF="sched_getscheduler.html"><B>sched_getscheduler</B>(2)</A> |
| | | , <A HREF="sched_getparam.html"><B>sched_getparam</B>(2)</A> , |
| | | <A HREF="pthread_attr_init.html"><B>pthread_attr_setschedpolicy</B>(3)</A> |
| | | , <A HREF="pthread_attr_init.html"><B>pthread_attr_setschedparam</B>(3)</A> |
| | | . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_SPIN_DESTROY"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;12074100"> |
| | | <META NAME="CHANGED" CONTENT="20050505;19014200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_spin_destroy, pthread_spin_init - destroy or initialize a |
| | | spin lock object (<B>ADVANCED REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>pthread_spinlock_t</B> <I>lock</I> <B>= |
| | | PTHREAD_SPINLOCK_INITIALIZER;</B></P> |
| | | <P><B>int pthread_spin_destroy(pthread_spinlock_t *</B><I>lock</I><B>); |
| | | <BR>int pthread_spin_init(pthread_spinlock_t *</B><I>lock</I><B>, int</B> |
| | | <I>pshared</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_spin_destroy</B> function shall destroy the spin |
| | | lock referenced by <I>lock</I> and release any resources used by the |
| | | lock. The effect of subsequent use of the lock is undefined until the |
| | | lock is reinitialized by another call to <B>pthread_spin_init</B> . |
| | | The results are undefined if <B>pthread_spin_destroy</B> is called |
| | | when a thread holds the lock, or if this function is called with an |
| | | uninitialized thread spin lock. |
| | | </P> |
| | | <P>The <B>pthread_spin_init</B> function shall allocate any resources |
| | | required to use the spin lock referenced by <I>lock</I> and |
| | | initialize the lock to an unlocked state. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> supports single and multiple processor systems |
| | | as well as process CPU affinity masking by checking the mask when the |
| | | spin lock is initialized. If the process is using only a single |
| | | processor at the time <B>pthread_spin_init</B> is called then the |
| | | spin lock is initialized as a PTHREAD_MUTEX_NORMAL mutex object. A |
| | | thread that calls <A HREF="pthread_spin_lock.html"><B>pthread_spin_lock(3)</B></A> |
| | | will block rather than spin in this case. If the process CPU affinity |
| | | mask is altered after the spin lock has been initialised, the spin |
| | | lock is not modified, and may no longer be optimal for the number of |
| | | CPUs available.</P> |
| | | <P><B>Pthreads-w32</B> defines <B>_POSIX_THREAD_PROCESS_SHARED</B> in |
| | | pthread.h as -1 to indicate that these routines do not support the |
| | | <B>PTHREAD_PROCESS_SHARED</B> attribute. <B>pthread_spin_init</B> |
| | | will return the error <B>ENOTSUP</B> if the value of <I>pshared</I> |
| | | is not <B>PTHREAD_PROCESS_PRIVATE</B>.</P> |
| | | <P>The results are undefined if <B>pthread_spin_init</B> is called |
| | | specifying an already initialized spin lock. The results are |
| | | undefined if a spin lock is used without first being initialized. |
| | | </P> |
| | | <P>If the <B>pthread_spin_init</B> function fails, the lock is not |
| | | initialized and the contents of <I>lock</I> are undefined. |
| | | </P> |
| | | <P>Only the object referenced by <I>lock</I> may be used for |
| | | performing synchronization. |
| | | </P> |
| | | <P>The result of referring to copies of that object in calls to |
| | | <B>pthread_spin_destroy</B> , <A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B>(3)</A> |
| | | , <A HREF="pthread_spin_lock.html"><B>pthread_spin_trylock</B>(3)</A>, |
| | | or <A HREF="pthread_spin_unlock.html"><B>pthread_spin_unlock</B>(3)</A> |
| | | is undefined. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> supports statically initialized spin locks |
| | | using <B>PTHREAD_SPINLOCK_INITIALIZER</B>. An application should |
| | | still call <B>pthread_spin_destroy</B> at some point to ensure that |
| | | any resources consumed by the spin lock are released.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, these functions shall return zero; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>These functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD> |
| | | The implementation has detected an attempt to initialize or destroy |
| | | a spin lock while it is in use (for example, while being used in a |
| | | <A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B>(3)</A> |
| | | call) by another thread. |
| | | </DD><DT> |
| | | <B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>lock</I> is invalid. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_spin_init</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>ENOTSUP</B> |
| | | </DT><DD> |
| | | The value of <I>pshared</I> is not <B>PTHREAD_PROCESS_PRIVATE</B>.</DD><DT> |
| | | <B>ENOMEM</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | Insufficient memory exists to initialize the lock. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>The <B>pthread_spin_destroy</B> and <B>pthread_spin_init</B> |
| | | functions are part of the Spin Locks option and need not be provided |
| | | on all implementations. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B>(3)</A> <B>,</B> |
| | | <A HREF="pthread_spin_unlock.html"><B>pthread_spin_unlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_SPIN_LOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;12202300"> |
| | | <META NAME="CHANGED" CONTENT="20050505;19302300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_spin_lock, pthread_spin_trylock - lock a spin lock object |
| | | (<B>ADVANCED REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_spin_lock(pthread_spinlock_t *</B><I>lock</I><B>); |
| | | <BR>int pthread_spin_trylock(pthread_spinlock_t *</B><I>lock</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_spin_lock</B> function shall lock the spin lock |
| | | referenced by <I>lock</I>. The calling thread shall acquire the lock |
| | | if it is not held by another thread. Otherwise, the thread shall spin |
| | | (that is, shall not return from the <B>pthread_spin_lock</B> call) |
| | | until the lock becomes available. The results are undefined if the |
| | | calling thread holds the lock at the time the call is made.</P> |
| | | <P><B>Pthreads-w32</B> supports single and multiple processor systems |
| | | as well as process CPU affinity masking by checking the mask when the |
| | | spin lock is initialized. If the process is using only a single |
| | | processor at the time <A HREF="pthread_spin_init.html"><B>pthread_spin_init</B>(3)</A> |
| | | is called then the spin lock is initialized as a PTHREAD_MUTEX_NORMAL |
| | | mutex object. A thread that calls <B>pthread_spin_lock</B> will block |
| | | rather than spin in this case. If the process CPU affinity mask is |
| | | altered after the spin lock has been initialised, the spin lock is |
| | | not modified, and may no longer be optimal for the number of CPUs |
| | | available.</P> |
| | | <P>The <B>pthread_spin_trylock</B> function shall lock the spin lock |
| | | referenced by <I>lock</I> if it is not held by any thread. Otherwise, |
| | | the function shall fail. |
| | | </P> |
| | | <P>The results are undefined if any of these functions is called with |
| | | an uninitialized spin lock. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, these functions shall return zero; |
| | | otherwise, an error number shall be returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>These functions may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value specified by <I>lock</I> does not refer to an initialized |
| | | spin lock object. |
| | | </DD></DL> |
| | | <P> |
| | | The <B>pthread_spin_trylock</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | A thread currently holds the lock. |
| | | </DD></DL> |
| | | <P> |
| | | These functions shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>Applications using this function may be subject to priority |
| | | inversion, as discussed in the Base Definitions volume of |
| | | IEEE Std 1003.1-2001, Section 3.285, Priority Inversion. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_spin_init.html"><B>pthread_spin_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_spin_unlock.html"><B>pthread_spin_unlock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"PTHREAD_SPIN_UNLOCK"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;12401400"> |
| | | <META NAME="CHANGED" CONTENT="20050505;12462400"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>pthread_spin_unlock - unlock a spin lock object (<B>ADVANCED |
| | | REALTIME THREADS</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h> </B> |
| | | </P> |
| | | <P><B>int pthread_spin_unlock(pthread_spinlock_t *</B><I>lock</I><B>); |
| | | </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>pthread_spin_unlock</B> function shall release the spin |
| | | lock referenced by <I>lock</I> which was locked via the |
| | | <A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B>(3)</A> or |
| | | <A HREF="pthread_spin_lock.html"><B>pthread_spin_trylock</B>(3)</A> |
| | | functions. If there are threads spinning on the lock when |
| | | <B>pthread_spin_unlock</B> is called, the lock becomes available and |
| | | an unspecified spinning thread shall acquire the lock. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> does not check ownership of the lock and it is |
| | | therefore possible for a thread other than the locker to unlock the |
| | | spin lock. This is not a feature that should be exploited.</P> |
| | | <P>The results are undefined if this function is called with an |
| | | uninitialized thread spin lock. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, the <B>pthread_spin_unlock</B> |
| | | function shall return zero; otherwise, an error number shall be |
| | | returned to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>pthread_spin_unlock</B> function may fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD> |
| | | An invalid argument was specified. |
| | | </DD><DD STYLE="margin-left: -2cm"> |
| | | <BR> |
| | | </DD></DL> |
| | | <P> |
| | | This function shall not return an error code of [EINTR]. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P><B>Pthreads-w32</B> does not check ownership of the lock and it is |
| | | therefore possible for a thread other than the locker to unlock the |
| | | spin lock. This is not a feature that should be exploited.</P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="pthread_spin_init.html"><B>pthread_spin_destroy</B>(3)</A> |
| | | <B>,</B> <A HREF="pthread_spin_lock.html"><B>pthread_spin_lock</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><pthread.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_TIMECHANGE_HANDLER_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;22110600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_timechange_handler_np – |
| | | alert timed waiting condition variables to system time changes.</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>void * pthread_timechange_handler_np(void * </B><I>dummy</I><B>);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>To improve tolerance against operator or time service initiated |
| | | system clock changes.</P> |
| | | <P><B>pthread_timechange_handler_np </B>can be called by an |
| | | application when it receives a WM_TIMECHANGE message from the system. |
| | | At present it broadcasts all condition variables so that waiting |
| | | threads can wake up and re-evaluate their conditions and restart |
| | | their timed waits if required.</P> |
| | | <P><B>pthread_timechange_handler_np </B>has the same return type and |
| | | argument type as a thread routine so that it may be called directly |
| | | through pthread_create(), i.e. as a separate thread. If run as a |
| | | thread, the return code must be retrieved through <A HREF="pthread_join.html"><B>pthread_join</B>()</A>.</P> |
| | | <P>Although the <I>dummy</I> parameter is required it is not used and |
| | | any value including NULL can be given.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4"><FONT COLOR="#000080">Return Value</FONT></A></H2> |
| | | <P><B>pthread_timechange_handler_np</B> returns 0 on success, or an |
| | | error code.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>The <B>pthread_timechange_handler_np</B> function returns the |
| | | following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EAGAIN</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <P STYLE="margin-left: 2cm; margin-bottom: 0cm"> |
| | | To indicate that not all condition variables were signalled for some |
| | | reason.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_WIN32_ATTACH_DETACH_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;22415600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_win32_process_attach_np, |
| | | pthread_win32_process_detach_np, pthread_win32_thread_attach_np, |
| | | pthread_win32_thread_detach_np – exposed versions of the |
| | | pthreads-w32 DLL dllMain() switch functionality for use when |
| | | statically linking the library.</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>BOOL pthread_win32_process_attach_np (void);</B></P> |
| | | <P><B>BOOL pthread_win32_process_detach_np (void);</B></P> |
| | | <P><B>BOOL pthread_win32_thread_attach_np (void);</B></P> |
| | | <P><B>BOOL pthread_win32_thread_detach_np (void);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>These functions contain the code normally run via <b>dllMain</b> |
| | | when the library is used as a dll but which need to be called |
| | | explicitly by an application when the library is statically linked. As of version 2.9.0, the static library built using either MSC or GCC includes RT hooks which will call the pthread_win32_process_*_np routines automatically on start/exit of the application.</P> |
| | | <P>You will need to call <B>pthread_win32_process_attach_np</B> |
| | | before you can call any pthread routines when statically linking. You |
| | | should call <B>pthread_win32_process_detach_np</B> before exiting |
| | | your application to clean up.</P> |
| | | <P><B>pthread_win32_thread_attach_np</B> is currently a no-op, but |
| | | <B>pthread_win32_thread_detach_np</B> is needed to clean up the |
| | | implicit pthread handle that is allocated to a Win32 thread if it |
| | | calls certain pthreads routines. Call this routine when the Win32 |
| | | thread exits.</P> |
| | | <P>These functions invariably return TRUE except for |
| | | <B>pthread_win32_process_attach_np</B> which will return FALSE if |
| | | pthreads-w32 initialisation fails.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4"><FONT COLOR="#000080">Return Value</FONT></A></H2> |
| | | <P>These routines return TRUE (non-zero) on success, or FALSE (0) if |
| | | they fail.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>PTHREAD_WIN32_TEST_FEATURES_NP manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;322600"> |
| | | <META NAME="CHANGED" CONTENT="20050510;17405600"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P STYLE="font-weight: medium">pthread_win32_test_features_np – |
| | | find out what features were detected at process attach time.</P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <pthread.h></B> |
| | | </P> |
| | | <P><B>BOOL pthread_win32_test_features_np(int</B> <I>mask</I><B>);</B></P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P><B>pthread_win32_test_features_np</B> allows an application to |
| | | check which run-time auto-detected features are available within the |
| | | library.</P> |
| | | <P>The possible features are:</P> |
| | | <P><B>PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE</B></P> |
| | | <P STYLE="margin-left: 2cm">Return TRUE if the Win32 version of |
| | | InterlockedCompareExchange() is being used. On IA32 systems the |
| | | library can use optimised and inlinable assembler versions of |
| | | InterlockedExchange() and InterlockedCompareExchange().</P> |
| | | <P><B>PTW32_ALERTABLE_ASYNC_CANCEL</B></P> |
| | | <P STYLE="margin-left: 2cm">Return TRUE if the QueueUserAPCEx package |
| | | QUSEREX.DLL and the AlertDrv.sys driver was detected. This package |
| | | provides alertable (pre-emptive) asynchronous threads cancellation. |
| | | If this feature returns FALSE then the default async cancel scheme is |
| | | in use, which cannot cancel blocked threads.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc4" NAME="sect4"><FONT COLOR="#000080">Return Value</FONT></A></H2> |
| | | <P><B>pthread_win32_test_features_np</B> returns TRUE (non-zero) if |
| | | the specified feature is present, and FALSE (0) otherwise.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Errors</A></H2> |
| | | <P>None.</P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Author</A></H2> |
| | | <P>Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Errors</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect6" NAME="toc6">Author</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"SCHED_GET_PRIORITY_MAX"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;12575100"> |
| | | <META NAME="CHANGED" CONTENT="20050510;12533300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>sched_get_priority_max, sched_get_priority_min - get priority |
| | | limits (<B>REALTIME</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <sched.h> </B> |
| | | </P> |
| | | <P><B>int sched_get_priority_max(int</B> <I>policy</I><B>); <BR>int |
| | | sched_get_priority_min(int</B> <I>policy</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>sched_get_priority_max</B> and <B>sched_get_priority_min</B> |
| | | functions shall return the appropriate maximum or minimum, |
| | | respectively, for the scheduling policy specified by <I>policy</I>. |
| | | </P> |
| | | <P>The value of <I>policy</I> shall be one of the scheduling policy |
| | | values defined in <I><sched.h></I>. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>If successful, the <B>sched_get_priority_max</B> and |
| | | <B>sched_get_priority_min</B> functions shall return the appropriate |
| | | maximum or minimum values, respectively. If unsuccessful, they shall |
| | | return a value of -1 and set <I>errno</I> to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>sched_get_priority_max</B> and <B>sched_get_priority_min</B> |
| | | functions shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | The value of the <I>policy</I> parameter does not represent a |
| | | defined scheduling policy. |
| | | </DD></DL> |
| | | <P> |
| | | <I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="sched_getscheduler.html"><B>sched_getscheduler</B>(3)</A> |
| | | <B>,</B> <A HREF="sched_setscheduler.html"><B>sched_setscheduler</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><sched.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"SCHED_GETSCHEDULER"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;13153500"> |
| | | <META NAME="CHANGED" CONTENT="20050505;13202000"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>sched_getscheduler - get scheduling policy (<B>REALTIME</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <sched.h> </B> |
| | | </P> |
| | | <P><B>int sched_getscheduler(pid_t</B> <I>pid</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>sched_getscheduler</B> function shall return the scheduling |
| | | policy of the process specified by <I>pid</I>. If the value of <I>pid</I> |
| | | is negative, the behavior of the <B>sched_getscheduler</B> function |
| | | is unspecified. |
| | | </P> |
| | | <P>The values that can be returned by <B>sched_getscheduler</B> are |
| | | defined in the <I><sched.h></I> header. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> only supports the <B>SCHED_OTHER</B> policy, |
| | | which is the only value that can be returned. However, checks on <I>pid</I> |
| | | and permissions are performed first so that the other useful side |
| | | effects of this routine are retained.</P> |
| | | <P>If a process specified by <I>pid</I> exists, and if the calling |
| | | process has permission, the scheduling policy shall be returned for |
| | | the process whose process ID is equal to <I>pid</I>. |
| | | </P> |
| | | <P>If <I>pid</I> is zero, the scheduling policy shall be returned for |
| | | the calling process. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, the <B>sched_getscheduler</B> function |
| | | shall return the scheduling policy of the specified process. If |
| | | unsuccessful, the function shall return -1 and set <I>errno</I> to |
| | | indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>sched_getscheduler</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EPERM</B> |
| | | </DT><DD> |
| | | The requesting process does not have permission to determine the |
| | | scheduling policy of the specified process. |
| | | </DD><DT> |
| | | <B>ESRCH</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | No process can be found corresponding to that specified by <I>pid</I>. |
| | | </DD></DL> |
| | | <P> |
| | | <I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="sched_setscheduler.html"><B>sched_setscheduler</B>(3)</A> |
| | | , the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><sched.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"SCHED_SETSCHEDULER"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;13012200"> |
| | | <META NAME="CHANGED" CONTENT="20050505;13193700"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>sched_setscheduler - set scheduling policy and parameters |
| | | (<B>REALTIME</B>) |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <sched.h> </B> |
| | | </P> |
| | | <P><B>int sched_setscheduler(pid_t</B> <I>pid</I><B>, int</B> <I>policy</I><B>, |
| | | const struct sched_param *</B><I>param</I><B>); </B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>sched_setscheduler</B> function shall set the scheduling |
| | | policy and scheduling parameters of the process specified by <I>pid</I> |
| | | to <I>policy</I> and the parameters specified in the <B>sched_param</B> |
| | | structure pointed to by <I>param</I>, respectively. The value of the |
| | | <I>sched_priority</I> member in the <B>sched_param</B> structure |
| | | shall be any integer within the inclusive priority range for the |
| | | scheduling policy specified by <I>policy</I>. If the value of <I>pid</I> |
| | | is negative, the behavior of the <B>sched_setscheduler</B> function |
| | | is unspecified. |
| | | </P> |
| | | <P>The possible values for the <I>policy</I> parameter are defined in |
| | | the <I><sched.h></I> header. |
| | | </P> |
| | | <P><B>Pthreads-w32</B> only supports the <B>SCHED_OTHER</B> policy. |
| | | Any other value for <I>policy</I> will return failure with errno set |
| | | to <B>ENOSYS</B>. However, checks on <I>pid</I> and permissions are |
| | | performed first so that the other useful side effects of this routine |
| | | are retained.</P> |
| | | <P>If a process specified by <I>pid</I> exists, and if the calling |
| | | process has permission, the scheduling policy and scheduling |
| | | parameters shall be set for the process whose process ID is equal to |
| | | <I>pid</I>. |
| | | </P> |
| | | <P>If <I>pid</I> is zero, the scheduling policy and scheduling |
| | | parameters shall be set for the calling process. |
| | | </P> |
| | | <P>Implementations may require that the requesting process have |
| | | permission to set its own scheduling parameters or those of another |
| | | process. Additionally, implementation-defined restrictions may apply |
| | | as to the appropriate privileges required to set a process’ own |
| | | scheduling policy, or another process’ scheduling policy, to a |
| | | particular value. |
| | | </P> |
| | | <P>The <B>sched_setscheduler</B> function shall be considered |
| | | successful if it succeeds in setting the scheduling policy and |
| | | scheduling parameters of the process specified by <I>pid</I> to the |
| | | values specified by <I>policy</I> and the structure pointed to by |
| | | <I>param</I>, respectively. |
| | | </P> |
| | | <P>The effect of this function on individual threads is dependent on |
| | | the scheduling contention scope of the threads: |
| | | </P> |
| | | <DL> |
| | | <DT>* |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | For threads with system scheduling contention scope, these functions |
| | | shall have no effect on their scheduling. |
| | | </DD><DT> |
| | | * |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | For threads with process scheduling contention scope, the threads’ |
| | | scheduling policy and associated parameters shall not be affected. |
| | | However, the scheduling of these threads with respect to threads in |
| | | other processes may be dependent on the scheduling parameters of |
| | | their process, which are governed using these functions. |
| | | </DD></DL> |
| | | <P> |
| | | This function is not atomic with respect to other threads in the |
| | | process. Threads may continue to execute while this function call is |
| | | in the process of changing the scheduling policy and associated |
| | | scheduling parameters for the underlying kernel-scheduled entities |
| | | used by the process contention scope threads. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>Upon successful completion, the function shall return the former |
| | | scheduling policy of the specified process. If the <B>sched_setscheduler</B> |
| | | function fails to complete successfully, the policy and scheduling |
| | | parameters shall remain unchanged, and the function shall return a |
| | | value of -1 and set <I>errno</I> to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>The <B>sched_setscheduler</B> function shall fail if: |
| | | </P> |
| | | <DL> |
| | | <DT><B>EINVAL</B> |
| | | </DT><DD> |
| | | The value of the <I>policy</I> parameter is invalid, or one or more |
| | | of the parameters contained in <I>param</I> is outside the valid |
| | | range for the specified scheduling policy. |
| | | </DD><DT> |
| | | <B>EPERM</B> |
| | | </DT><DD> |
| | | The requesting process does not have permission to set either or |
| | | both of the scheduling parameters or the scheduling policy of the |
| | | specified process. |
| | | </DD><DT> |
| | | <B>ESRCH</B> |
| | | </DT><DD STYLE="margin-bottom: 0.5cm"> |
| | | No process can be found corresponding to that specified by <I>pid</I>. |
| | | </DD></DL> |
| | | <P> |
| | | <I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P><A HREF="sched_getscheduler.html"><B>sched_getscheduler</B>(3)</A> |
| | | <B>,</B> the Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><sched.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>"SCHED_YIELD"(P) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;14034600"> |
| | | <META NAME="CHANGED" CONTENT="20050505;14050300"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>sched_yield - yield the processor |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <sched.h> </B> |
| | | </P> |
| | | <P><B>int sched_yield(void);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>The <B>sched_yield</B> function shall force the running thread to |
| | | relinquish the processor until it again becomes the head of its |
| | | thread list. It takes no arguments. |
| | | </P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Return Value</A></H2> |
| | | <P>The <B>sched_yield</B> function shall return 0 if it completes |
| | | successfully; otherwise, it shall return a value of -1 and set <I>errno</I> |
| | | to indicate the error. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Errors</A></H2> |
| | | <P>No errors are defined. |
| | | </P> |
| | | <P><I>The following sections are informative.</I> |
| | | </P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Examples</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Application Usage</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc7" NAME="sect7">Rationale</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc8" NAME="sect8">Future Directions</A></H2> |
| | | <P>None. |
| | | </P> |
| | | <H2><A HREF="#toc9" NAME="sect9">See Also</A></H2> |
| | | <P>The Base Definitions volume of IEEE Std 1003.1-2001, |
| | | <I><sched.h></I> |
| | | </P> |
| | | <H2><A HREF="#toc10" NAME="sect10">Copyright</A></H2> |
| | | <P>Portions of this text are reprinted and reproduced in electronic |
| | | form from IEEE Std 1003.1, 2003 Edition, Standard for Information |
| | | Technology -- Portable Operating System Interface (POSIX), The Open |
| | | Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the |
| | | Institute of Electrical and Electronics Engineers, Inc and The Open |
| | | Group. In the event of any discrepancy between this version and the |
| | | original IEEE and The Open Group Standard, the original IEEE and The |
| | | Open Group Standard is the referee document. The original Standard |
| | | can be obtained online at <A HREF="http://www.opengroup.org/unix/online.html">http://www.opengroup.org/unix/online.html</A> |
| | | . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Examples</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Application |
| | | Usage</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Rationale</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect8" NAME="toc8">Future |
| | | Directions</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect9" NAME="toc9">See |
| | | Also</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect10" NAME="toc10">Copyright</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| | | <HTML> |
| | | <HEAD> |
| | | <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> |
| | | <TITLE>SEMAPHORES(3) manual page</TITLE> |
| | | <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3 (Linux)"> |
| | | <META NAME="CREATED" CONTENT="20050505;14061900"> |
| | | <META NAME="CHANGED" CONTENT="20050514;195200"> |
| | | <!-- manual page source format generated by PolyglotMan v3.2, --> |
| | | <!-- available at http://polyglotman.sourceforge.net/ --> |
| | | </HEAD> |
| | | <BODY LANG="en-GB" BGCOLOR="#ffffff" DIR="LTR"> |
| | | <H4>POSIX Threads for Windows – REFERENCE - <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A></H4> |
| | | <P><A HREF="index.html">Reference Index</A></P> |
| | | <P><A HREF="#toc">Table of Contents</A></P> |
| | | <H2><A HREF="#toc0" NAME="sect0">Name</A></H2> |
| | | <P>sem_init, sem_wait, sem_trywait, sem_post, sem_getvalue, |
| | | sem_destroy - operations on semaphores |
| | | </P> |
| | | <H2><A HREF="#toc1" NAME="sect1">Synopsis</A></H2> |
| | | <P><B>#include <semaphore.h></B> |
| | | </P> |
| | | <P><B>int sem_init(sem_t *</B><I>sem</I><B>, int </B><I>pshared</I><B>, |
| | | unsigned int </B><I>value</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_wait(sem_t * </B><I>sem</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_timedwait(sem_t * </B><I>sem</I>, <B>const struct |
| | | timespec *</B><I>abstime</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_trywait(sem_t * </B><I>sem</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_post(sem_t * </B><I>sem</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_post_multiple(sem_t * </B><I>sem, </I><B>int</B> |
| | | <I>number</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_getvalue(sem_t * </B><I>sem</I><B>, int * </B><I>sval</I><B>);</B> |
| | | </P> |
| | | <P><B>int sem_destroy(sem_t * </B><I>sem</I><B>);</B> |
| | | </P> |
| | | <H2><A HREF="#toc2" NAME="sect2">Description</A></H2> |
| | | <P>Semaphores are counters for resources shared between threads. The |
| | | basic operations on semaphores are: increment the counter atomically, |
| | | and wait until the counter is non-null and decrement it atomically. |
| | | </P> |
| | | <P><B>sem_init</B> initializes the semaphore object pointed to by |
| | | <I>sem</I>. The count associated with the semaphore is set initially |
| | | to <I>value</I>. The <I>pshared</I> argument indicates whether the |
| | | semaphore is local to the current process ( <I>pshared</I> is zero) |
| | | or is to be shared between several processes ( <I>pshared</I> is not |
| | | zero).</P> |
| | | <P><B>Pthreads-w32</B> currently does not support process-shared |
| | | semaphores, thus <B>sem_init</B> always returns with error <B>EPERM</B> |
| | | if <I>pshared</I> is not zero. |
| | | </P> |
| | | <P><B>sem_wait</B> atomically decrements <I>sem</I>'s count if it is |
| | | greater than 0 and returns immediately or it suspends the calling |
| | | thread until it can resume following a call to <B>sem_post</B> or |
| | | <B>sem_post_multiple</B>.</P> |
| | | <P><B>sem_timedwait</B> atomically decrements <I>sem</I>'s count if |
| | | it is greater than 0 and returns immediately, or it suspends the |
| | | calling thread. If <I>abstime</I> time arrives before the thread can |
| | | resume following a call to <B>sem_post</B> or <B>sem_post_multiple</B>, |
| | | then <B>sem_timedwait</B> returns with a return code of -1 after |
| | | having set <B>errno</B> to <B>ETIMEDOUT</B>. If the call can return |
| | | without suspending then <I>abstime</I> is not checked.</P> |
| | | <P><B>sem_trywait</B> atomically decrements <I>sem</I>'s count if it |
| | | is greater than 0 and returns immediately, or it returns immediately |
| | | with a return code of -1 after having set <B>errno</B> to <B>EAGAIN</B>. |
| | | <B>sem_trywait</B> never blocks.</P> |
| | | <P><B>sem_post</B> either releases one thread if there are any |
| | | waiting on <I>sem</I>, or it atomically increments <I>sem</I>'s |
| | | count.</P> |
| | | <P><B>sem_post_multiple</B> either releases multiple threads if there |
| | | are any waiting on <I>sem</I> and/or it atomically increases <I>sem</I>'s |
| | | count. If there are currently <I>n</I> waiters, where <I>n</I> the |
| | | largest number less than or equal to <I>number</I>, then <I>n</I> |
| | | waiters are released and <I>sem</I>'s count is incremented by <I>number</I> |
| | | minus <I>n</I>.</P> |
| | | <P><B>sem_getvalue</B> stores in the location pointed to by <I>sval</I> |
| | | the current count of the semaphore <I>sem</I>. In the <B>Pthreads-w32</B> |
| | | implementation: if the value returned in <I>sval</I> is greater than |
| | | or equal to 0 it was the <I>sem</I>'s count at some point during the |
| | | call to <B>sem_getvalue</B>. If the value returned in <I>sval</I> is |
| | | less than 0 then it's absolute value represents the number of threads |
| | | waiting on <I>sem</I> at some point during the call to <B>sem_getvalue. |
| | | </B>POSIX does not require an implementation of <B>sem_getvalue</B> |
| | | to return a value in <I>sval</I> that is less than 0, but if it does |
| | | then it's absolute value must represent the number of waiters.</P> |
| | | <P><B>sem_destroy</B> destroys a semaphore object, freeing the |
| | | resources it might hold. No threads should be waiting on the |
| | | semaphore at the time <B>sem_destroy</B> is called.</P> |
| | | <H2><A HREF="#toc3" NAME="sect3">Cancellation</A></H2> |
| | | <P><B>sem_wait</B> and <B>sem_timedwait</B> are cancellation points. |
| | | </P> |
| | | <H2><A HREF="#toc4" NAME="sect4">Async-signal Safety</A></H2> |
| | | <P>These routines are not async-cancel safe.</P> |
| | | <H2><A HREF="#toc5" NAME="sect5">Return Value</A></H2> |
| | | <P>All semaphore functions return 0 on success, or -1 on error in |
| | | which case they write an error code in <B>errno</B>. |
| | | </P> |
| | | <H2><A HREF="#toc6" NAME="sect6">Errors</A></H2> |
| | | <P>The <B>sem_init</B> function sets <B>errno</B> to the following |
| | | codes on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EINVAL</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <I>value</I> exceeds the maximal counter value <B>SEM_VALUE_MAX</B> |
| | | </DD><DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | <B>ENOSYS</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 3cm"> |
| | | <I>pshared</I> is not zero |
| | | </BLOCKQUOTE> |
| | | <P>The <B>sem_timedwait</B> function sets <B>errno</B> to the |
| | | following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ETIMEDOUT</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 3cm"> |
| | | if <I>abstime</I> arrives before the waiting thread can resume |
| | | following a call to <B>sem_post</B> or <B>sem_post_multiple</B>. |
| | | </BLOCKQUOTE> |
| | | <P>The <B>sem_trywait</B> function sets <B>errno</B> to the following |
| | | error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EAGAIN</B> |
| | | </DT></DL> |
| | | </DL> |
| | | <BLOCKQUOTE STYLE="margin-left: 3cm"> |
| | | if the semaphore count is currently 0 |
| | | </BLOCKQUOTE> |
| | | <P>The <B>sem_post</B> and <B>sem_post_multiple</B> functions set |
| | | <B>errno</B> to the following error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>ERANGE</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | if after incrementing, the semaphore count would exceed |
| | | <B>SEM_VALUE_MAX</B> (the semaphore count is left unchanged in this |
| | | case) |
| | | </DD></DL> |
| | | </DL> |
| | | <P> |
| | | The <B>sem_destroy</B> function sets <B>errno</B> to the following |
| | | error code on error: |
| | | </P> |
| | | <DL> |
| | | <DL> |
| | | <DT STYLE="margin-right: 1cm; margin-bottom: 0.5cm"><B>EBUSY</B> |
| | | </DT><DD STYLE="margin-right: 1cm; margin-bottom: 0.5cm"> |
| | | if some threads are currently blocked waiting on the semaphore. |
| | | </DD></DL> |
| | | </DL> |
| | | <H2> |
| | | <A HREF="#toc7" NAME="sect7">Author</A></H2> |
| | | <P>Xavier Leroy <Xavier.Leroy@inria.fr> |
| | | </P> |
| | | <P>Modified by Ross Johnson for use with <A HREF="http://sources.redhat.com/pthreads-win32">Pthreads-w32</A>.</P> |
| | | <H2><A HREF="#toc8" NAME="sect8">See Also</A></H2> |
| | | <P><A HREF="pthread_mutex_init.html"><B>pthread_mutex_init</B>(3)</A> |
| | | , <A HREF="pthread_cond_init.html"><B>pthread_cond_init</B>(3)</A> , |
| | | <A HREF="pthread_cancel.html"><B>pthread_cancel</B>(3)</A> . |
| | | </P> |
| | | <HR> |
| | | <P><A NAME="toc"></A><B>Table of Contents</B></P> |
| | | <UL> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect0" NAME="toc0">Name</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect1" NAME="toc1">Synopsis</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect2" NAME="toc2">Description</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect3" NAME="toc3">Cancellation</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect4" NAME="toc4">Async-signal |
| | | Safety</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect5" NAME="toc5">Return |
| | | Value</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect6" NAME="toc6">Errors</A> |
| | | </P> |
| | | <LI><P STYLE="margin-bottom: 0cm"><A HREF="#sect7" NAME="toc7">Author</A> |
| | | </P> |
| | | <LI><P><A HREF="#sect8" NAME="toc8">See Also</A> |
| | | </P> |
| | | </UL> |
| | | </BODY> |
| | | </HTML> |
New file |
| | |
| | | /*** |
| | | * errno.h - system wide error numbers (set by system calls) |
| | | * |
| | | * Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved. |
| | | * |
| | | * Purpose: |
| | | * This file defines the system-wide error numbers (set by |
| | | * system calls). Conforms to the XENIX standard. Extended |
| | | * for compatibility with Uniforum standard. |
| | | * [System V] |
| | | * |
| | | * [Public] |
| | | * |
| | | ****/ |
| | | |
| | | #if _MSC_VER > 1000 |
| | | #pragma once |
| | | #endif |
| | | |
| | | #if !defined(_INC_ERRNO) |
| | | #define _INC_ERRNO |
| | | |
| | | #if !defined(_WIN32) |
| | | #error ERROR: Only Win32 targets supported! |
| | | #endif |
| | | |
| | | #include <winsock.h> |
| | | |
| | | #if defined(__cplusplus) |
| | | extern "C" { |
| | | #endif |
| | | |
| | | |
| | | |
| | | /* Define _CRTIMP */ |
| | | |
| | | #ifndef _CRTIMP |
| | | #if defined(_DLL) |
| | | #define _CRTIMP __declspec(dllimport) |
| | | #else /* ndef _DLL */ |
| | | #define _CRTIMP |
| | | #endif /* _DLL */ |
| | | #endif /* _CRTIMP */ |
| | | |
| | | |
| | | /* Define __cdecl for non-Microsoft compilers */ |
| | | |
| | | #if ( !defined(_MSC_VER) && !defined(__cdecl) ) |
| | | #define __cdecl |
| | | #endif |
| | | |
| | | /* Define _CRTAPI1 (for compatibility with the NT SDK) */ |
| | | |
| | | #if !defined(_CRTAPI1) |
| | | #if _MSC_VER >= 800 && _M_IX86 >= 300 |
| | | #define _CRTAPI1 __cdecl |
| | | #else |
| | | #define _CRTAPI1 |
| | | #endif |
| | | #endif |
| | | |
| | | #if !defined(PTW32_STATIC_LIB) |
| | | # if defined(PTW32_BUILD) |
| | | # define PTW32_DLLPORT __declspec (dllexport) |
| | | # else |
| | | # define PTW32_DLLPORT __declspec (dllimport) |
| | | # endif |
| | | #else |
| | | # define PTW32_DLLPORT |
| | | #endif |
| | | |
| | | /* declare reference to errno */ |
| | | |
| | | #if (defined(_MT) || defined(_MD) || defined(_DLL)) && !defined(_MAC) |
| | | PTW32_DLLPORT int * __cdecl _errno(void); |
| | | #define errno (*_errno()) |
| | | #else /* ndef _MT && ndef _MD && ndef _DLL */ |
| | | _CRTIMP extern int errno; |
| | | #endif /* _MT || _MD || _DLL */ |
| | | |
| | | /* Error Codes */ |
| | | |
| | | #define EPERM 1 |
| | | #define ENOENT 2 |
| | | #define ESRCH 3 |
| | | #define EINTR 4 |
| | | #define EIO 5 |
| | | #define ENXIO 6 |
| | | #define E2BIG 7 |
| | | #define ENOEXEC 8 |
| | | #define EBADF 9 |
| | | #define ECHILD 10 |
| | | #define EAGAIN 11 |
| | | #define ENOMEM 12 |
| | | #define EACCES 13 |
| | | #define EFAULT 14 |
| | | #define EBUSY 16 |
| | | #define EEXIST 17 |
| | | #define EXDEV 18 |
| | | #define ENODEV 19 |
| | | #define ENOTDIR 20 |
| | | #define EISDIR 21 |
| | | #define EINVAL 22 |
| | | #define ENFILE 23 |
| | | #define EMFILE 24 |
| | | #define ENOTTY 25 |
| | | #define EFBIG 27 |
| | | #define ENOSPC 28 |
| | | #define ESPIPE 29 |
| | | #define EROFS 30 |
| | | #define EMLINK 31 |
| | | #define EPIPE 32 |
| | | #define EDOM 33 |
| | | #define ERANGE 34 |
| | | #define EDEADLK 36 |
| | | |
| | | /* defined differently in winsock.h on WinCE */ |
| | | #if !defined(ENAMETOOLONG) |
| | | #define ENAMETOOLONG 38 |
| | | #endif |
| | | |
| | | #define ENOLCK 39 |
| | | #define ENOSYS 40 |
| | | |
| | | /* defined differently in winsock.h on WinCE */ |
| | | #if !defined(ENOTEMPTY) |
| | | #define ENOTEMPTY 41 |
| | | #endif |
| | | |
| | | #define EILSEQ 42 |
| | | |
| | | /* POSIX 2008 - robust mutexes */ |
| | | #define EOWNERDEAD 43 |
| | | #define ENOTRECOVERABLE 44 |
| | | |
| | | /* |
| | | * Support EDEADLOCK for compatibiity with older MS-C versions. |
| | | */ |
| | | #define EDEADLOCK EDEADLK |
| | | |
| | | #if defined(__cplusplus) |
| | | } |
| | | #endif |
| | | |
| | | #endif /* _INC_ERRNO */ |
New file |
| | |
| | | /* This is an implementation of the threads API of POSIX 1003.1-2001. |
| | | * |
| | | * -------------------------------------------------------------------------- |
| | | * |
| | | * Pthreads-win32 - POSIX Threads Library for Win32 |
| | | * Copyright(C) 1998 John E. Bossom |
| | | * Copyright(C) 1999,2005 Pthreads-win32 contributors |
| | | * |
| | | * Contact Email: rpj@callisto.canberra.edu.au |
| | | * |
| | | * The current list of contributors is contained |
| | | * in the file CONTRIBUTORS included with the source |
| | | * code distribution. The list can also be seen at the |
| | | * following World Wide Web location: |
| | | * http://sources.redhat.com/pthreads-win32/contributors.html |
| | | * |
| | | * This library is free software; you can redistribute it and/or |
| | | * modify it under the terms of the GNU Lesser General Public |
| | | * License as published by the Free Software Foundation; either |
| | | * version 2 of the License, or (at your option) any later version. |
| | | * |
| | | * This library is distributed in the hope that it will be useful, |
| | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| | | * Lesser General Public License for more details. |
| | | * |
| | | * You should have received a copy of the GNU Lesser General Public |
| | | * License along with this library in the file COPYING.LIB; |
| | | * if not, write to the Free Software Foundation, Inc., |
| | | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
| | | */ |
| | | |
| | | #if !defined( PTHREAD_H ) |
| | | #define PTHREAD_H |
| | | #define HAVE_STRUCT_TIMESPEC |
| | | |
| | | /* |
| | | * See the README file for an explanation of the pthreads-win32 version |
| | | * numbering scheme and how the DLL is named etc. |
| | | */ |
| | | #define PTW32_VERSION 2,9,1,0 |
| | | #define PTW32_VERSION_STRING "2, 9, 1, 0\0" |
| | | |
| | | /* There are three implementations of cancel cleanup. |
| | | * Note that pthread.h is included in both application |
| | | * compilation units and also internally for the library. |
| | | * The code here and within the library aims to work |
| | | * for all reasonable combinations of environments. |
| | | * |
| | | * The three implementations are: |
| | | * |
| | | * WIN32 SEH |
| | | * C |
| | | * C++ |
| | | * |
| | | * Please note that exiting a push/pop block via |
| | | * "return", "exit", "break", or "continue" will |
| | | * lead to different behaviour amongst applications |
| | | * depending upon whether the library was built |
| | | * using SEH, C++, or C. For example, a library built |
| | | * with SEH will call the cleanup routine, while both |
| | | * C++ and C built versions will not. |
| | | */ |
| | | |
| | | /* |
| | | * Define defaults for cleanup code. |
| | | * Note: Unless the build explicitly defines one of the following, then |
| | | * we default to standard C style cleanup. This style uses setjmp/longjmp |
| | | * in the cancelation and thread exit implementations and therefore won't |
| | | * do stack unwinding if linked to applications that have it (e.g. |
| | | * C++ apps). This is currently consistent with most/all commercial Unix |
| | | * POSIX threads implementations. |
| | | */ |
| | | #if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) |
| | | # define __CLEANUP_C |
| | | #endif |
| | | |
| | | #if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC)) |
| | | #error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler. |
| | | #endif |
| | | |
| | | /* |
| | | * Stop here if we are being included by the resource compiler. |
| | | */ |
| | | #if !defined(RC_INVOKED) |
| | | |
| | | #undef PTW32_LEVEL |
| | | |
| | | #if defined(_POSIX_SOURCE) |
| | | #define PTW32_LEVEL 0 |
| | | /* Early POSIX */ |
| | | #endif |
| | | |
| | | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 |
| | | #undef PTW32_LEVEL |
| | | #define PTW32_LEVEL 1 |
| | | /* Include 1b, 1c and 1d */ |
| | | #endif |
| | | |
| | | #if defined(INCLUDE_NP) |
| | | #undef PTW32_LEVEL |
| | | #define PTW32_LEVEL 2 |
| | | /* Include Non-Portable extensions */ |
| | | #endif |
| | | |
| | | #define PTW32_LEVEL_MAX 3 |
| | | |
| | | #if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_LEVEL) |
| | | #define PTW32_LEVEL PTW32_LEVEL_MAX |
| | | /* Include everything */ |
| | | #endif |
| | | |
| | | #if defined(_UWIN) |
| | | # define HAVE_STRUCT_TIMESPEC 1 |
| | | # define HAVE_SIGNAL_H 1 |
| | | # undef HAVE_PTW32_CONFIG_H |
| | | # pragma comment(lib, "pthread") |
| | | #endif |
| | | |
| | | /* |
| | | * ------------------------------------------------------------- |
| | | * |
| | | * |
| | | * Module: pthread.h |
| | | * |
| | | * Purpose: |
| | | * Provides an implementation of PThreads based upon the |
| | | * standard: |
| | | * |
| | | * POSIX 1003.1-2001 |
| | | * and |
| | | * The Single Unix Specification version 3 |
| | | * |
| | | * (these two are equivalent) |
| | | * |
| | | * in order to enhance code portability between Windows, |
| | | * various commercial Unix implementations, and Linux. |
| | | * |
| | | * See the ANNOUNCE file for a full list of conforming |
| | | * routines and defined constants, and a list of missing |
| | | * routines and constants not defined in this implementation. |
| | | * |
| | | * Authors: |
| | | * There have been many contributors to this library. |
| | | * The initial implementation was contributed by |
| | | * John Bossom, and several others have provided major |
| | | * sections or revisions of parts of the implementation. |
| | | * Often significant effort has been contributed to |
| | | * find and fix important bugs and other problems to |
| | | * improve the reliability of the library, which sometimes |
| | | * is not reflected in the amount of code which changed as |
| | | * result. |
| | | * As much as possible, the contributors are acknowledged |
| | | * in the ChangeLog file in the source code distribution |
| | | * where their changes are noted in detail. |
| | | * |
| | | * Contributors are listed in the CONTRIBUTORS file. |
| | | * |
| | | * As usual, all bouquets go to the contributors, and all |
| | | * brickbats go to the project maintainer. |
| | | * |
| | | * Maintainer: |
| | | * The code base for this project is coordinated and |
| | | * eventually pre-tested, packaged, and made available by |
| | | * |
| | | * Ross Johnson <rpj@callisto.canberra.edu.au> |
| | | * |
| | | * QA Testers: |
| | | * Ultimately, the library is tested in the real world by |
| | | * a host of competent and demanding scientists and |
| | | * engineers who report bugs and/or provide solutions |
| | | * which are then fixed or incorporated into subsequent |
| | | * versions of the library. Each time a bug is fixed, a |
| | | * test case is written to prove the fix and ensure |
| | | * that later changes to the code don't reintroduce the |
| | | * same error. The number of test cases is slowly growing |
| | | * and therefore so is the code reliability. |
| | | * |
| | | * Compliance: |
| | | * See the file ANNOUNCE for the list of implemented |
| | | * and not-implemented routines and defined options. |
| | | * Of course, these are all defined is this file as well. |
| | | * |
| | | * Web site: |
| | | * The source code and other information about this library |
| | | * are available from |
| | | * |
| | | * http://sources.redhat.com/pthreads-win32/ |
| | | * |
| | | * ------------------------------------------------------------- |
| | | */ |
| | | |
| | | /* Try to avoid including windows.h */ |
| | | #if (defined(__MINGW64__) || defined(__MINGW32__)) && defined(__cplusplus) |
| | | #define PTW32_INCLUDE_WINDOWS_H |
| | | #endif |
| | | |
| | | #if defined(PTW32_INCLUDE_WINDOWS_H) |
| | | #include <windows.h> |
| | | #endif |
| | | |
| | | #if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) |
| | | /* |
| | | * VC++6.0 or early compiler's header has no DWORD_PTR type. |
| | | */ |
| | | typedef unsigned long DWORD_PTR; |
| | | typedef unsigned long ULONG_PTR; |
| | | #endif |
| | | /* |
| | | * ----------------- |
| | | * autoconf switches |
| | | * ----------------- |
| | | */ |
| | | |
| | | #if defined(HAVE_PTW32_CONFIG_H) |
| | | #include "config.h" |
| | | #endif /* HAVE_PTW32_CONFIG_H */ |
| | | |
| | | #if !defined(NEED_FTIME) |
| | | #include <time.h> |
| | | #else /* NEED_FTIME */ |
| | | /* use native WIN32 time API */ |
| | | #endif /* NEED_FTIME */ |
| | | |
| | | #if defined(HAVE_SIGNAL_H) |
| | | #include <signal.h> |
| | | #endif /* HAVE_SIGNAL_H */ |
| | | |
| | | #include <limits.h> |
| | | |
| | | /* |
| | | * Boolean values to make us independent of system includes. |
| | | */ |
| | | enum { |
| | | PTW32_FALSE = 0, |
| | | PTW32_TRUE = (! PTW32_FALSE) |
| | | }; |
| | | |
| | | /* |
| | | * This is a duplicate of what is in the autoconf config.h, |
| | | * which is only used when building the pthread-win32 libraries. |
| | | */ |
| | | |
| | | #if !defined(PTW32_CONFIG_H) |
| | | # if defined(WINCE) |
| | | # define NEED_ERRNO |
| | | # define NEED_SEM |
| | | # endif |
| | | # if defined(__MINGW64__) |
| | | # define HAVE_STRUCT_TIMESPEC |
| | | # define HAVE_MODE_T |
| | | # elif defined(_UWIN) || defined(__MINGW32__) |
| | | # define HAVE_MODE_T |
| | | # endif |
| | | #endif |
| | | |
| | | /* |
| | | * |
| | | */ |
| | | |
| | | #if PTW32_LEVEL >= PTW32_LEVEL_MAX |
| | | #if defined(NEED_ERRNO) |
| | | #include "need_errno.h" |
| | | #else |
| | | #include <errno.h> |
| | | #endif |
| | | #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ |
| | | |
| | | /* |
| | | * Several systems don't define some error numbers. |
| | | */ |
| | | #if !defined(ENOTSUP) |
| | | # define ENOTSUP 48 /* This is the value in Solaris. */ |
| | | #endif |
| | | |
| | | #if !defined(ETIMEDOUT) |
| | | # define ETIMEDOUT 10060 /* Same as WSAETIMEDOUT */ |
| | | #endif |
| | | |
| | | #if !defined(ENOSYS) |
| | | # define ENOSYS 140 /* Semi-arbitrary value */ |
| | | #endif |
| | | |
| | | #if !defined(EDEADLK) |
| | | # if defined(EDEADLOCK) |
| | | # define EDEADLK EDEADLOCK |
| | | # else |
| | | # define EDEADLK 36 /* This is the value in MSVC. */ |
| | | # endif |
| | | #endif |
| | | |
| | | /* POSIX 2008 - related to robust mutexes */ |
| | | #if !defined(EOWNERDEAD) |
| | | # define EOWNERDEAD 43 |
| | | #endif |
| | | #if !defined(ENOTRECOVERABLE) |
| | | # define ENOTRECOVERABLE 44 |
| | | #endif |
| | | |
| | | #include <sched.h> |
| | | |
| | | /* |
| | | * To avoid including windows.h we define only those things that we |
| | | * actually need from it. |
| | | */ |
| | | #if !defined(PTW32_INCLUDE_WINDOWS_H) |
| | | #if !defined(HANDLE) |
| | | # define PTW32__HANDLE_DEF |
| | | # define HANDLE void * |
| | | #endif |
| | | #if !defined(DWORD) |
| | | # define PTW32__DWORD_DEF |
| | | # define DWORD unsigned long |
| | | #endif |
| | | #endif |
| | | |
| | | #if !defined(HAVE_STRUCT_TIMESPEC) |
| | | #define HAVE_STRUCT_TIMESPEC |
| | | #if !defined(_TIMESPEC_DEFINED) |
| | | #define _TIMESPEC_DEFINED |
| | | struct timespec { |
| | | time_t tv_sec; |
| | | long tv_nsec; |
| | | }; |
| | | #endif /* _TIMESPEC_DEFINED */ |
| | | #endif /* HAVE_STRUCT_TIMESPEC */ |
| | | |
| | | #if !defined(SIG_BLOCK) |
| | | #define SIG_BLOCK 0 |
| | | #endif /* SIG_BLOCK */ |
| | | |
| | | #if !defined(SIG_UNBLOCK) |
| | | #define SIG_UNBLOCK 1 |
| | | #endif /* SIG_UNBLOCK */ |
| | | |
| | | #if !defined(SIG_SETMASK) |
| | | #define SIG_SETMASK 2 |
| | | #endif /* SIG_SETMASK */ |
| | | |
| | | #if defined(__cplusplus) |
| | | extern "C" |
| | | { |
| | | #endif /* __cplusplus */ |
| | | |
| | | /* |
| | | * ------------------------------------------------------------- |
| | | * |
| | | * POSIX 1003.1-2001 Options |
| | | * ========================= |
| | | * |
| | | * Options are normally set in <unistd.h>, which is not provided |
| | | * with pthreads-win32. |
| | | * |
| | | * For conformance with the Single Unix Specification (version 3), all of the |
| | | * options below are defined, and have a value of either -1 (not supported) |
| | | * or 200112L (supported). |
| | | * |
| | | * These options can neither be left undefined nor have a value of 0, because |
| | | * either indicates that sysconf(), which is not implemented, may be used at |
| | | * runtime to check the status of the option. |
| | | * |
| | | * _POSIX_THREADS (== 200112L) |
| | | * If == 200112L, you can use threads |
| | | * |
| | | * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) |
| | | * If == 200112L, you can control the size of a thread's |
| | | * stack |
| | | * pthread_attr_getstacksize |
| | | * pthread_attr_setstacksize |
| | | * |
| | | * _POSIX_THREAD_ATTR_STACKADDR (== -1) |
| | | * If == 200112L, you can allocate and control a thread's |
| | | * stack. If not supported, the following functions |
| | | * will return ENOSYS, indicating they are not |
| | | * supported: |
| | | * pthread_attr_getstackaddr |
| | | * pthread_attr_setstackaddr |
| | | * |
| | | * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) |
| | | * If == 200112L, you can use realtime scheduling. |
| | | * This option indicates that the behaviour of some |
| | | * implemented functions conforms to the additional TPS |
| | | * requirements in the standard. E.g. rwlocks favour |
| | | * writers over readers when threads have equal priority. |
| | | * |
| | | * _POSIX_THREAD_PRIO_INHERIT (== -1) |
| | | * If == 200112L, you can create priority inheritance |
| | | * mutexes. |
| | | * pthread_mutexattr_getprotocol + |
| | | * pthread_mutexattr_setprotocol + |
| | | * |
| | | * _POSIX_THREAD_PRIO_PROTECT (== -1) |
| | | * If == 200112L, you can create priority ceiling mutexes |
| | | * Indicates the availability of: |
| | | * pthread_mutex_getprioceiling |
| | | * pthread_mutex_setprioceiling |
| | | * pthread_mutexattr_getprioceiling |
| | | * pthread_mutexattr_getprotocol + |
| | | * pthread_mutexattr_setprioceiling |
| | | * pthread_mutexattr_setprotocol + |
| | | * |
| | | * _POSIX_THREAD_PROCESS_SHARED (== -1) |
| | | * If set, you can create mutexes and condition |
| | | * variables that can be shared with another |
| | | * process.If set, indicates the availability |
| | | * of: |
| | | * pthread_mutexattr_getpshared |
| | | * pthread_mutexattr_setpshared |
| | | * pthread_condattr_getpshared |
| | | * pthread_condattr_setpshared |
| | | * |
| | | * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) |
| | | * If == 200112L you can use the special *_r library |
| | | * functions that provide thread-safe behaviour |
| | | * |
| | | * _POSIX_READER_WRITER_LOCKS (== 200112L) |
| | | * If == 200112L, you can use read/write locks |
| | | * |
| | | * _POSIX_SPIN_LOCKS (== 200112L) |
| | | * If == 200112L, you can use spin locks |
| | | * |
| | | * _POSIX_BARRIERS (== 200112L) |
| | | * If == 200112L, you can use barriers |
| | | * |
| | | * + These functions provide both 'inherit' and/or |
| | | * 'protect' protocol, based upon these macro |
| | | * settings. |
| | | * |
| | | * ------------------------------------------------------------- |
| | | */ |
| | | |
| | | /* |
| | | * POSIX Options |
| | | */ |
| | | #undef _POSIX_THREADS |
| | | #define _POSIX_THREADS 200809L |
| | | |
| | | #undef _POSIX_READER_WRITER_LOCKS |
| | | #define _POSIX_READER_WRITER_LOCKS 200809L |
| | | |
| | | #undef _POSIX_SPIN_LOCKS |
| | | #define _POSIX_SPIN_LOCKS 200809L |
| | | |
| | | #undef _POSIX_BARRIERS |
| | | #define _POSIX_BARRIERS 200809L |
| | | |
| | | #undef _POSIX_THREAD_SAFE_FUNCTIONS |
| | | #define _POSIX_THREAD_SAFE_FUNCTIONS 200809L |
| | | |
| | | #undef _POSIX_THREAD_ATTR_STACKSIZE |
| | | #define _POSIX_THREAD_ATTR_STACKSIZE 200809L |
| | | |
| | | /* |
| | | * The following options are not supported |
| | | */ |
| | | #undef _POSIX_THREAD_ATTR_STACKADDR |
| | | #define _POSIX_THREAD_ATTR_STACKADDR -1 |
| | | |
| | | #undef _POSIX_THREAD_PRIO_INHERIT |
| | | #define _POSIX_THREAD_PRIO_INHERIT -1 |
| | | |
| | | #undef _POSIX_THREAD_PRIO_PROTECT |
| | | #define _POSIX_THREAD_PRIO_PROTECT -1 |
| | | |
| | | /* TPS is not fully supported. */ |
| | | #undef _POSIX_THREAD_PRIORITY_SCHEDULING |
| | | #define _POSIX_THREAD_PRIORITY_SCHEDULING -1 |
| | | |
| | | #undef _POSIX_THREAD_PROCESS_SHARED |
| | | #define _POSIX_THREAD_PROCESS_SHARED -1 |
| | | |
| | | |
| | | /* |
| | | * POSIX 1003.1-2001 Limits |
| | | * =========================== |
| | | * |
| | | * These limits are normally set in <limits.h>, which is not provided with |
| | | * pthreads-win32. |
| | | * |
| | | * PTHREAD_DESTRUCTOR_ITERATIONS |
| | | * Maximum number of attempts to destroy |
| | | * a thread's thread-specific data on |
| | | * termination (must be at least 4) |
| | | * |
| | | * PTHREAD_KEYS_MAX |
| | | * Maximum number of thread-specific data keys |
| | | * available per process (must be at least 128) |
| | | * |
| | | * PTHREAD_STACK_MIN |
| | | * Minimum supported stack size for a thread |
| | | * |
| | | * PTHREAD_THREADS_MAX |
| | | * Maximum number of threads supported per |
| | | * process (must be at least 64). |
| | | * |
| | | * SEM_NSEMS_MAX |
| | | * The maximum number of semaphores a process can have. |
| | | * (must be at least 256) |
| | | * |
| | | * SEM_VALUE_MAX |
| | | * The maximum value a semaphore can have. |
| | | * (must be at least 32767) |
| | | * |
| | | */ |
| | | #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS |
| | | #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 |
| | | |
| | | #undef PTHREAD_DESTRUCTOR_ITERATIONS |
| | | #define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS |
| | | |
| | | #undef _POSIX_THREAD_KEYS_MAX |
| | | #define _POSIX_THREAD_KEYS_MAX 128 |
| | | |
| | | #undef PTHREAD_KEYS_MAX |
| | | #define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX |
| | | |
| | | #undef PTHREAD_STACK_MIN |
| | | #define PTHREAD_STACK_MIN 0 |
| | | |
| | | #undef _POSIX_THREAD_THREADS_MAX |
| | | #define _POSIX_THREAD_THREADS_MAX 64 |
| | | |
| | | /* Arbitrary value */ |
| | | #undef PTHREAD_THREADS_MAX |
| | | #define PTHREAD_THREADS_MAX 2019 |
| | | |
| | | #undef _POSIX_SEM_NSEMS_MAX |
| | | #define _POSIX_SEM_NSEMS_MAX 256 |
| | | |
| | | /* Arbitrary value */ |
| | | #undef SEM_NSEMS_MAX |
| | | #define SEM_NSEMS_MAX 1024 |
| | | |
| | | #undef _POSIX_SEM_VALUE_MAX |
| | | #define _POSIX_SEM_VALUE_MAX 32767 |
| | | |
| | | #undef SEM_VALUE_MAX |
| | | #define SEM_VALUE_MAX INT_MAX |
| | | |
| | | |
| | | #if defined(__GNUC__) && !defined(__declspec) |
| | | # error Please upgrade your GNU compiler to one that supports __declspec. |
| | | #endif |
| | | |
| | | /* |
| | | * When building the library, you should define PTW32_BUILD so that |
| | | * the variables/functions are exported correctly. When using the library, |
| | | * do NOT define PTW32_BUILD, and then the variables/functions will |
| | | * be imported correctly. |
| | | */ |
| | | #if !defined(PTW32_STATIC_LIB) |
| | | # if defined(PTW32_BUILD) |
| | | # define PTW32_DLLPORT __declspec (dllexport) |
| | | # else |
| | | # define PTW32_DLLPORT __declspec (dllimport) |
| | | # endif |
| | | #else |
| | | # define PTW32_DLLPORT |
| | | #endif |
| | | |
| | | /* |
| | | * The Open Watcom C/C++ compiler uses a non-standard calling convention |
| | | * that passes function args in registers unless __cdecl is explicitly specified |
| | | * in exposed function prototypes. |
| | | * |
| | | * We force all calls to cdecl even though this could slow Watcom code down |
| | | * slightly. If you know that the Watcom compiler will be used to build both |
| | | * the DLL and application, then you can probably define this as a null string. |
| | | * Remember that pthread.h (this file) is used for both the DLL and application builds. |
| | | */ |
| | | #define PTW32_CDECL __cdecl |
| | | |
| | | #if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX |
| | | # include <sys/types.h> |
| | | #else |
| | | /* |
| | | * Generic handle type - intended to extend uniqueness beyond |
| | | * that available with a simple pointer. It should scale for either |
| | | * IA-32 or IA-64. |
| | | */ |
| | | typedef struct { |
| | | void * p; /* Pointer to actual object */ |
| | | unsigned int x; /* Extra information - reuse count etc */ |
| | | } ptw32_handle_t; |
| | | |
| | | typedef ptw32_handle_t pthread_t; |
| | | typedef struct pthread_attr_t_ * pthread_attr_t; |
| | | typedef struct pthread_once_t_ pthread_once_t; |
| | | typedef struct pthread_key_t_ * pthread_key_t; |
| | | typedef struct pthread_mutex_t_ * pthread_mutex_t; |
| | | typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; |
| | | typedef struct pthread_cond_t_ * pthread_cond_t; |
| | | typedef struct pthread_condattr_t_ * pthread_condattr_t; |
| | | #endif |
| | | typedef struct pthread_rwlock_t_ * pthread_rwlock_t; |
| | | typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; |
| | | typedef struct pthread_spinlock_t_ * pthread_spinlock_t; |
| | | typedef struct pthread_barrier_t_ * pthread_barrier_t; |
| | | typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; |
| | | |
| | | /* |
| | | * ==================== |
| | | * ==================== |
| | | * POSIX Threads |
| | | * ==================== |
| | | * ==================== |
| | | */ |
| | | |
| | | enum { |
| | | /* |
| | | * pthread_attr_{get,set}detachstate |
| | | */ |
| | | PTHREAD_CREATE_JOINABLE = 0, /* Default */ |
| | | PTHREAD_CREATE_DETACHED = 1, |
| | | |
| | | /* |
| | | * pthread_attr_{get,set}inheritsched |
| | | */ |
| | | PTHREAD_INHERIT_SCHED = 0, |
| | | PTHREAD_EXPLICIT_SCHED = 1, /* Default */ |
| | | |
| | | /* |
| | | * pthread_{get,set}scope |
| | | */ |
| | | PTHREAD_SCOPE_PROCESS = 0, |
| | | PTHREAD_SCOPE_SYSTEM = 1, /* Default */ |
| | | |
| | | /* |
| | | * pthread_setcancelstate paramters |
| | | */ |
| | | PTHREAD_CANCEL_ENABLE = 0, /* Default */ |
| | | PTHREAD_CANCEL_DISABLE = 1, |
| | | |
| | | /* |
| | | * pthread_setcanceltype parameters |
| | | */ |
| | | PTHREAD_CANCEL_ASYNCHRONOUS = 0, |
| | | PTHREAD_CANCEL_DEFERRED = 1, /* Default */ |
| | | |
| | | /* |
| | | * pthread_mutexattr_{get,set}pshared |
| | | * pthread_condattr_{get,set}pshared |
| | | */ |
| | | PTHREAD_PROCESS_PRIVATE = 0, |
| | | PTHREAD_PROCESS_SHARED = 1, |
| | | |
| | | /* |
| | | * pthread_mutexattr_{get,set}robust |
| | | */ |
| | | PTHREAD_MUTEX_STALLED = 0, /* Default */ |
| | | PTHREAD_MUTEX_ROBUST = 1, |
| | | |
| | | /* |
| | | * pthread_barrier_wait |
| | | */ |
| | | PTHREAD_BARRIER_SERIAL_THREAD = -1 |
| | | }; |
| | | |
| | | /* |
| | | * ==================== |
| | | * ==================== |
| | | * Cancelation |
| | | * ==================== |
| | | * ==================== |
| | | */ |
| | | #define PTHREAD_CANCELED ((void *)(size_t) -1) |
| | | |
| | | |
| | | /* |
| | | * ==================== |
| | | * ==================== |
| | | * Once Key |
| | | * ==================== |
| | | * ==================== |
| | | */ |
| | | #define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} |
| | | |
| | | struct pthread_once_t_ |
| | | { |
| | | int done; /* indicates if user function has been executed */ |
| | | void * lock; |
| | | int reserved1; |
| | | int reserved2; |
| | | }; |
| | | |
| | | |
| | | /* |
| | | * ==================== |
| | | * ==================== |
| | | * Object initialisers |
| | | * ==================== |
| | | * ==================== |
| | | */ |
| | | #define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -1) |
| | | #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -2) |
| | | #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -3) |
| | | |
| | | /* |
| | | * Compatibility with LinuxThreads |
| | | */ |
| | | #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER |
| | | #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER |
| | | |
| | | #define PTHREAD_COND_INITIALIZER ((pthread_cond_t)(size_t) -1) |
| | | |
| | | #define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)(size_t) -1) |
| | | |
| | | #define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t)(size_t) -1) |
| | | |
| | | |
| | | /* |
| | | * Mutex types. |
| | | */ |
| | | enum |
| | | { |
| | | /* Compatibility with LinuxThreads */ |
| | | PTHREAD_MUTEX_FAST_NP, |
| | | PTHREAD_MUTEX_RECURSIVE_NP, |
| | | PTHREAD_MUTEX_ERRORCHECK_NP, |
| | | PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, |
| | | PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, |
| | | /* For compatibility with POSIX */ |
| | | PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, |
| | | PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, |
| | | PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, |
| | | PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL |
| | | }; |
| | | |
| | | |
| | | typedef struct ptw32_cleanup_t ptw32_cleanup_t; |
| | | |
| | | #if defined(_MSC_VER) |
| | | /* Disable MSVC 'anachronism used' warning */ |
| | | #pragma warning( disable : 4229 ) |
| | | #endif |
| | | |
| | | typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); |
| | | |
| | | #if defined(_MSC_VER) |
| | | #pragma warning( default : 4229 ) |
| | | #endif |
| | | |
| | | struct ptw32_cleanup_t |
| | | { |
| | | ptw32_cleanup_callback_t routine; |
| | | void *arg; |
| | | struct ptw32_cleanup_t *prev; |
| | | }; |
| | | |
| | | #if defined(__CLEANUP_SEH) |
| | | /* |
| | | * WIN32 SEH version of cancel cleanup. |
| | | */ |
| | | |
| | | #define pthread_cleanup_push( _rout, _arg ) \ |
| | | { \ |
| | | ptw32_cleanup_t _cleanup; \ |
| | | \ |
| | | _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ |
| | | _cleanup.arg = (_arg); \ |
| | | __try \ |
| | | { \ |
| | | |
| | | #define pthread_cleanup_pop( _execute ) \ |
| | | } \ |
| | | __finally \ |
| | | { \ |
| | | if( _execute || AbnormalTermination()) \ |
| | | { \ |
| | | (*(_cleanup.routine))( _cleanup.arg ); \ |
| | | } \ |
| | | } \ |
| | | } |
| | | |
| | | #else /* __CLEANUP_SEH */ |
| | | |
| | | #if defined(__CLEANUP_C) |
| | | |
| | | /* |
| | | * C implementation of PThreads cancel cleanup |
| | | */ |
| | | |
| | | #define pthread_cleanup_push( _rout, _arg ) \ |
| | | { \ |
| | | ptw32_cleanup_t _cleanup; \ |
| | | \ |
| | | ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ |
| | | |
| | | #define pthread_cleanup_pop( _execute ) \ |
| | | (void) ptw32_pop_cleanup( _execute ); \ |
| | | } |
| | | |
| | | #else /* __CLEANUP_C */ |
| | | |
| | | #if defined(__CLEANUP_CXX) |
| | | |
| | | /* |
| | | * C++ version of cancel cleanup. |
| | | * - John E. Bossom. |
| | | */ |
| | | |
| | | class PThreadCleanup { |
| | | /* |
| | | * PThreadCleanup |
| | | * |
| | | * Purpose |
| | | * This class is a C++ helper class that is |
| | | * used to implement pthread_cleanup_push/ |
| | | * pthread_cleanup_pop. |
| | | * The destructor of this class automatically |
| | | * pops the pushed cleanup routine regardless |
| | | * of how the code exits the scope |
| | | * (i.e. such as by an exception) |
| | | */ |
| | | ptw32_cleanup_callback_t cleanUpRout; |
| | | void * obj; |
| | | int executeIt; |
| | | |
| | | public: |
| | | PThreadCleanup() : |
| | | cleanUpRout( 0 ), |
| | | obj( 0 ), |
| | | executeIt( 0 ) |
| | | /* |
| | | * No cleanup performed |
| | | */ |
| | | { |
| | | } |
| | | |
| | | PThreadCleanup( |
| | | ptw32_cleanup_callback_t routine, |
| | | void * arg ) : |
| | | cleanUpRout( routine ), |
| | | obj( arg ), |
| | | executeIt( 1 ) |
| | | /* |
| | | * Registers a cleanup routine for 'arg' |
| | | */ |
| | | { |
| | | } |
| | | |
| | | ~PThreadCleanup() |
| | | { |
| | | if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) |
| | | { |
| | | (void) (*cleanUpRout)( obj ); |
| | | } |
| | | } |
| | | |
| | | void execute( int exec ) |
| | | { |
| | | executeIt = exec; |
| | | } |
| | | }; |
| | | |
| | | /* |
| | | * C++ implementation of PThreads cancel cleanup; |
| | | * This implementation takes advantage of a helper |
| | | * class who's destructor automatically calls the |
| | | * cleanup routine if we exit our scope weirdly |
| | | */ |
| | | #define pthread_cleanup_push( _rout, _arg ) \ |
| | | { \ |
| | | PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ |
| | | (void *) (_arg) ); |
| | | |
| | | #define pthread_cleanup_pop( _execute ) \ |
| | | cleanup.execute( _execute ); \ |
| | | } |
| | | |
| | | #else |
| | | |
| | | #error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. |
| | | |
| | | #endif /* __CLEANUP_CXX */ |
| | | |
| | | #endif /* __CLEANUP_C */ |
| | | |
| | | #endif /* __CLEANUP_SEH */ |
| | | |
| | | /* |
| | | * =============== |
| | | * =============== |
| | | * Methods |
| | | * =============== |
| | | * =============== |
| | | */ |
| | | |
| | | /* |
| | | * PThread Attribute Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, |
| | | int *detachstate); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, |
| | | void **stackaddr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, |
| | | size_t * stacksize); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, |
| | | int detachstate); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, |
| | | void *stackaddr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, |
| | | size_t stacksize); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, |
| | | struct sched_param *param); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, |
| | | const struct sched_param *param); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, |
| | | int); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *, |
| | | int *); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, |
| | | int inheritsched); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr, |
| | | int * inheritsched); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, |
| | | int); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, |
| | | int *); |
| | | |
| | | /* |
| | | * PThread Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, |
| | | const pthread_attr_t * attr, |
| | | void *(PTW32_CDECL *start) (void *), |
| | | void *arg); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, |
| | | pthread_t t2); |
| | | |
| | | PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, |
| | | void **value_ptr); |
| | | |
| | | PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, |
| | | int *oldstate); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, |
| | | int *oldtype); |
| | | |
| | | PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, |
| | | void (PTW32_CDECL *init_routine) (void)); |
| | | |
| | | #if PTW32_LEVEL >= PTW32_LEVEL_MAX |
| | | PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); |
| | | |
| | | PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, |
| | | ptw32_cleanup_callback_t routine, |
| | | void *arg); |
| | | #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ |
| | | |
| | | /* |
| | | * Thread Specific Data Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, |
| | | void (PTW32_CDECL *destructor) (void *)); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, |
| | | const void *value); |
| | | |
| | | PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); |
| | | |
| | | |
| | | /* |
| | | * Mutex Attribute Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t |
| | | * attr, |
| | | int *pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, |
| | | int pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setrobust( |
| | | pthread_mutexattr_t *attr, |
| | | int robust); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getrobust( |
| | | const pthread_mutexattr_t * attr, |
| | | int * robust); |
| | | |
| | | /* |
| | | * Barrier Attribute Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t |
| | | * attr, |
| | | int *pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, |
| | | int pshared); |
| | | |
| | | /* |
| | | * Mutex Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, |
| | | const pthread_mutexattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex, |
| | | const struct timespec *abstime); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutex_consistent (pthread_mutex_t * mutex); |
| | | |
| | | /* |
| | | * Spinlock Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); |
| | | |
| | | /* |
| | | * Barrier Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, |
| | | const pthread_barrierattr_t * attr, |
| | | unsigned int count); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); |
| | | |
| | | /* |
| | | * Condition Variable Attribute Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, |
| | | int *pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, |
| | | int pshared); |
| | | |
| | | /* |
| | | * Condition Variable Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, |
| | | const pthread_condattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, |
| | | pthread_mutex_t * mutex); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, |
| | | pthread_mutex_t * mutex, |
| | | const struct timespec *abstime); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); |
| | | |
| | | /* |
| | | * Scheduling |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, |
| | | int policy, |
| | | const struct sched_param *param); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, |
| | | int *policy, |
| | | struct sched_param *param); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); |
| | | |
| | | /* |
| | | * Read-Write Lock Functions |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, |
| | | const pthread_rwlockattr_t *attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, |
| | | const struct timespec *abstime); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, |
| | | const struct timespec *abstime); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, |
| | | int *pshared); |
| | | |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, |
| | | int pshared); |
| | | |
| | | #if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 |
| | | |
| | | /* |
| | | * Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32 |
| | | * already have signal.h that don't define these. |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); |
| | | |
| | | /* |
| | | * Non-portable functions |
| | | */ |
| | | |
| | | /* |
| | | * Compatibility with Linux. |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, |
| | | int kind); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, |
| | | int *kind); |
| | | |
| | | /* |
| | | * Possibly supported by other POSIX threads implementations |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); |
| | | PTW32_DLLPORT unsigned __int64 PTW32_CDECL pthread_getunique_np(pthread_t thread); |
| | | |
| | | /* |
| | | * Useful if an application wants to statically link |
| | | * the lib rather than load the DLL at run-time. |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); |
| | | |
| | | /* |
| | | * Features that are auto-detected at load/run time. |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); |
| | | enum ptw32_features { |
| | | PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ |
| | | PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ |
| | | }; |
| | | |
| | | /* |
| | | * Register a system time change with the library. |
| | | * Causes the library to perform various functions |
| | | * in response to the change. Should be called whenever |
| | | * the application's top level window receives a |
| | | * WM_TIMECHANGE message. It can be passed directly to |
| | | * pthread_create() as a new thread if desired. |
| | | */ |
| | | PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); |
| | | |
| | | #endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ |
| | | |
| | | #if PTW32_LEVEL >= PTW32_LEVEL_MAX |
| | | |
| | | /* |
| | | * Returns the Win32 HANDLE for the POSIX thread. |
| | | */ |
| | | PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); |
| | | /* |
| | | * Returns the win32 thread ID for POSIX thread. |
| | | */ |
| | | PTW32_DLLPORT DWORD PTW32_CDECL pthread_getw32threadid_np (pthread_t thread); |
| | | |
| | | |
| | | /* |
| | | * Protected Methods |
| | | * |
| | | * This function blocks until the given WIN32 handle |
| | | * is signaled or pthread_cancel had been called. |
| | | * This function allows the caller to hook into the |
| | | * PThreads cancel mechanism. It is implemented using |
| | | * |
| | | * WaitForMultipleObjects |
| | | * |
| | | * on 'waitHandle' and a manually reset WIN32 Event |
| | | * used to implement pthread_cancel. The 'timeout' |
| | | * argument to TimedWait is simply passed to |
| | | * WaitForMultipleObjects. |
| | | */ |
| | | PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); |
| | | PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, |
| | | DWORD timeout); |
| | | |
| | | #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ |
| | | |
| | | /* |
| | | * Thread-Safe C Runtime Library Mappings. |
| | | */ |
| | | #if !defined(_UWIN) |
| | | # if defined(NEED_ERRNO) |
| | | PTW32_DLLPORT int * PTW32_CDECL _errno( void ); |
| | | # else |
| | | # if !defined(errno) |
| | | # if (defined(_MT) || defined(_DLL)) |
| | | __declspec(dllimport) extern int * __cdecl _errno(void); |
| | | # define errno (*_errno()) |
| | | # endif |
| | | # endif |
| | | # endif |
| | | #endif |
| | | |
| | | /* |
| | | * Some compiler environments don't define some things. |
| | | */ |
| | | #if defined(__BORLANDC__) |
| | | # define _ftime ftime |
| | | # define _timeb timeb |
| | | #endif |
| | | |
| | | #if defined(__cplusplus) |
| | | |
| | | /* |
| | | * Internal exceptions |
| | | */ |
| | | class ptw32_exception {}; |
| | | class ptw32_exception_cancel : public ptw32_exception {}; |
| | | class ptw32_exception_exit : public ptw32_exception {}; |
| | | |
| | | #endif |
| | | |
| | | #if PTW32_LEVEL >= PTW32_LEVEL_MAX |
| | | |
| | | /* FIXME: This is only required if the library was built using SEH */ |
| | | /* |
| | | * Get internal SEH tag |
| | | */ |
| | | PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); |
| | | |
| | | #endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ |
| | | |
| | | #if !defined(PTW32_BUILD) |
| | | |
| | | #if defined(__CLEANUP_SEH) |
| | | |
| | | /* |
| | | * Redefine the SEH __except keyword to ensure that applications |
| | | * propagate our internal exceptions up to the library's internal handlers. |
| | | */ |
| | | #define __except( E ) \ |
| | | __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ |
| | | ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) |
| | | |
| | | #endif /* __CLEANUP_SEH */ |
| | | |
| | | #if defined(__CLEANUP_CXX) |
| | | |
| | | /* |
| | | * Redefine the C++ catch keyword to ensure that applications |
| | | * propagate our internal exceptions up to the library's internal handlers. |
| | | */ |
| | | #if defined(_MSC_VER) |
| | | /* |
| | | * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' |
| | | * if you want Pthread-Win32 cancelation and pthread_exit to work. |
| | | */ |
| | | |
| | | #if !defined(PtW32NoCatchWarn) |
| | | |
| | | #pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") |
| | | #pragma message("------------------------------------------------------------------") |
| | | #pragma message("When compiling applications with MSVC++ and C++ exception handling:") |
| | | #pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") |
| | | #pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") |
| | | #pragma message(" cancelation and pthread_exit to work. For example:") |
| | | #pragma message("") |
| | | #pragma message(" #if defined(PtW32CatchAll)") |
| | | #pragma message(" PtW32CatchAll") |
| | | #pragma message(" #else") |
| | | #pragma message(" catch(...)") |
| | | #pragma message(" #endif") |
| | | #pragma message(" {") |
| | | #pragma message(" /* Catchall block processing */") |
| | | #pragma message(" }") |
| | | #pragma message("------------------------------------------------------------------") |
| | | |
| | | #endif |
| | | |
| | | #define PtW32CatchAll \ |
| | | catch( ptw32_exception & ) { throw; } \ |
| | | catch( ... ) |
| | | |
| | | #else /* _MSC_VER */ |
| | | |
| | | #define catch( E ) \ |
| | | catch( ptw32_exception & ) { throw; } \ |
| | | catch( E ) |
| | | |
| | | #endif /* _MSC_VER */ |
| | | |
| | | #endif /* __CLEANUP_CXX */ |
| | | |
| | | #endif /* ! PTW32_BUILD */ |
| | | |
| | | #if defined(__cplusplus) |
| | | } /* End of extern "C" */ |
| | | #endif /* __cplusplus */ |
| | | |
| | | #if defined(PTW32__HANDLE_DEF) |
| | | # undef HANDLE |
| | | #endif |
| | | #if defined(PTW32__DWORD_DEF) |
| | | # undef DWORD |
| | | #endif |
| | | |
| | | #undef PTW32_LEVEL |
| | | #undef PTW32_LEVEL_MAX |
| | | |
| | | #endif /* ! RC_INVOKED */ |
| | | |
| | | #endif /* PTHREAD_H */ |
New file |
| | |
| | | /* |
| | | * Module: sched.h |
| | | * |
| | | * Purpose: |
| | | * Provides an implementation of POSIX realtime extensions |
| | | * as defined in |
| | | * |
| | | * POSIX 1003.1b-1993 (POSIX.1b) |
| | | * |
| | | * -------------------------------------------------------------------------- |
| | | * |
| | | * Pthreads-win32 - POSIX Threads Library for Win32 |
| | | * Copyright(C) 1998 John E. Bossom |
| | | * Copyright(C) 1999,2005 Pthreads-win32 contributors |
| | | * |
| | | * Contact Email: rpj@callisto.canberra.edu.au |
| | | * |
| | | * The current list of contributors is contained |
| | | * in the file CONTRIBUTORS included with the source |
| | | * code distribution. The list can also be seen at the |
| | | * following World Wide Web location: |
| | | * http://sources.redhat.com/pthreads-win32/contributors.html |
| | | * |
| | | * This library is free software; you can redistribute it and/or |
| | | * modify it under the terms of the GNU Lesser General Public |
| | | * License as published by the Free Software Foundation; either |
| | | * version 2 of the License, or (at your option) any later version. |
| | | * |
| | | * This library is distributed in the hope that it will be useful, |
| | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| | | * Lesser General Public License for more details. |
| | | * |
| | | * You should have received a copy of the GNU Lesser General Public |
| | | * License along with this library in the file COPYING.LIB; |
| | | * if not, write to the Free Software Foundation, Inc., |
| | | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
| | | */ |
| | | #if !defined(_SCHED_H) |
| | | #define _SCHED_H |
| | | |
| | | #undef PTW32_SCHED_LEVEL |
| | | |
| | | #if defined(_POSIX_SOURCE) |
| | | #define PTW32_SCHED_LEVEL 0 |
| | | /* Early POSIX */ |
| | | #endif |
| | | |
| | | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 |
| | | #undef PTW32_SCHED_LEVEL |
| | | #define PTW32_SCHED_LEVEL 1 |
| | | /* Include 1b, 1c and 1d */ |
| | | #endif |
| | | |
| | | #if defined(INCLUDE_NP) |
| | | #undef PTW32_SCHED_LEVEL |
| | | #define PTW32_SCHED_LEVEL 2 |
| | | /* Include Non-Portable extensions */ |
| | | #endif |
| | | |
| | | #define PTW32_SCHED_LEVEL_MAX 3 |
| | | |
| | | #if ( defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112 ) || !defined(PTW32_SCHED_LEVEL) |
| | | #define PTW32_SCHED_LEVEL PTW32_SCHED_LEVEL_MAX |
| | | /* Include everything */ |
| | | #endif |
| | | |
| | | |
| | | #if defined(__GNUC__) && !defined(__declspec) |
| | | # error Please upgrade your GNU compiler to one that supports __declspec. |
| | | #endif |
| | | |
| | | /* |
| | | * When building the library, you should define PTW32_BUILD so that |
| | | * the variables/functions are exported correctly. When using the library, |
| | | * do NOT define PTW32_BUILD, and then the variables/functions will |
| | | * be imported correctly. |
| | | */ |
| | | #if !defined(PTW32_STATIC_LIB) |
| | | # if defined(PTW32_BUILD) |
| | | # define PTW32_DLLPORT __declspec (dllexport) |
| | | # else |
| | | # define PTW32_DLLPORT __declspec (dllimport) |
| | | # endif |
| | | #else |
| | | # define PTW32_DLLPORT |
| | | #endif |
| | | |
| | | /* |
| | | * This is a duplicate of what is in the autoconf config.h, |
| | | * which is only used when building the pthread-win32 libraries. |
| | | */ |
| | | |
| | | #if !defined(PTW32_CONFIG_H) |
| | | # if defined(WINCE) |
| | | # define NEED_ERRNO |
| | | # define NEED_SEM |
| | | # endif |
| | | # if defined(__MINGW64__) |
| | | # define HAVE_STRUCT_TIMESPEC |
| | | # define HAVE_MODE_T |
| | | # elif defined(_UWIN) || defined(__MINGW32__) |
| | | # define HAVE_MODE_T |
| | | # endif |
| | | #endif |
| | | |
| | | /* |
| | | * |
| | | */ |
| | | |
| | | #if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX |
| | | #if defined(NEED_ERRNO) |
| | | #include "need_errno.h" |
| | | #else |
| | | #include <errno.h> |
| | | #endif |
| | | #endif /* PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX */ |
| | | |
| | | #if (defined(__MINGW64__) || defined(__MINGW32__)) || defined(_UWIN) |
| | | # if PTW32_SCHED_LEVEL >= PTW32_SCHED_LEVEL_MAX |
| | | /* For pid_t */ |
| | | # include <sys/types.h> |
| | | /* Required by Unix 98 */ |
| | | # include <time.h> |
| | | # else |
| | | typedef int pid_t; |
| | | # endif |
| | | #else |
| | | typedef int pid_t; |
| | | #endif |
| | | |
| | | /* Thread scheduling policies */ |
| | | |
| | | enum { |
| | | SCHED_OTHER = 0, |
| | | SCHED_FIFO, |
| | | SCHED_RR, |
| | | SCHED_MIN = SCHED_OTHER, |
| | | SCHED_MAX = SCHED_RR |
| | | }; |
| | | |
| | | struct sched_param { |
| | | int sched_priority; |
| | | }; |
| | | |
| | | #if defined(__cplusplus) |
| | | extern "C" |
| | | { |
| | | #endif /* __cplusplus */ |
| | | |
| | | PTW32_DLLPORT int __cdecl sched_yield (void); |
| | | |
| | | PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); |
| | | |
| | | PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); |
| | | |
| | | PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); |
| | | |
| | | PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); |
| | | |
| | | /* |
| | | * Note that this macro returns ENOTSUP rather than |
| | | * ENOSYS as might be expected. However, returning ENOSYS |
| | | * should mean that sched_get_priority_{min,max} are |
| | | * not implemented as well as sched_rr_get_interval. |
| | | * This is not the case, since we just don't support |
| | | * round-robin scheduling. Therefore I have chosen to |
| | | * return the same value as sched_setscheduler when |
| | | * SCHED_RR is passed to it. |
| | | */ |
| | | #define sched_rr_get_interval(_pid, _interval) \ |
| | | ( errno = ENOTSUP, (int) -1 ) |
| | | |
| | | |
| | | #if defined(__cplusplus) |
| | | } /* End of extern "C" */ |
| | | #endif /* __cplusplus */ |
| | | |
| | | #undef PTW32_SCHED_LEVEL |
| | | #undef PTW32_SCHED_LEVEL_MAX |
| | | |
| | | #endif /* !_SCHED_H */ |
| | | |
New file |
| | |
| | | /* |
| | | * Module: semaphore.h |
| | | * |
| | | * Purpose: |
| | | * Semaphores aren't actually part of the PThreads standard. |
| | | * They are defined by the POSIX Standard: |
| | | * |
| | | * POSIX 1003.1b-1993 (POSIX.1b) |
| | | * |
| | | * -------------------------------------------------------------------------- |
| | | * |
| | | * Pthreads-win32 - POSIX Threads Library for Win32 |
| | | * Copyright(C) 1998 John E. Bossom |
| | | * Copyright(C) 1999,2005 Pthreads-win32 contributors |
| | | * |
| | | * Contact Email: rpj@callisto.canberra.edu.au |
| | | * |
| | | * The current list of contributors is contained |
| | | * in the file CONTRIBUTORS included with the source |
| | | * code distribution. The list can also be seen at the |
| | | * following World Wide Web location: |
| | | * http://sources.redhat.com/pthreads-win32/contributors.html |
| | | * |
| | | * This library is free software; you can redistribute it and/or |
| | | * modify it under the terms of the GNU Lesser General Public |
| | | * License as published by the Free Software Foundation; either |
| | | * version 2 of the License, or (at your option) any later version. |
| | | * |
| | | * This library is distributed in the hope that it will be useful, |
| | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| | | * Lesser General Public License for more details. |
| | | * |
| | | * You should have received a copy of the GNU Lesser General Public |
| | | * License along with this library in the file COPYING.LIB; |
| | | * if not, write to the Free Software Foundation, Inc., |
| | | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
| | | */ |
| | | #if !defined( SEMAPHORE_H ) |
| | | #define SEMAPHORE_H |
| | | |
| | | #undef PTW32_SEMAPHORE_LEVEL |
| | | |
| | | #if defined(_POSIX_SOURCE) |
| | | #define PTW32_SEMAPHORE_LEVEL 0 |
| | | /* Early POSIX */ |
| | | #endif |
| | | |
| | | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 |
| | | #undef PTW32_SEMAPHORE_LEVEL |
| | | #define PTW32_SEMAPHORE_LEVEL 1 |
| | | /* Include 1b, 1c and 1d */ |
| | | #endif |
| | | |
| | | #if defined(INCLUDE_NP) |
| | | #undef PTW32_SEMAPHORE_LEVEL |
| | | #define PTW32_SEMAPHORE_LEVEL 2 |
| | | /* Include Non-Portable extensions */ |
| | | #endif |
| | | |
| | | #define PTW32_SEMAPHORE_LEVEL_MAX 3 |
| | | |
| | | #if !defined(PTW32_SEMAPHORE_LEVEL) |
| | | #define PTW32_SEMAPHORE_LEVEL PTW32_SEMAPHORE_LEVEL_MAX |
| | | /* Include everything */ |
| | | #endif |
| | | |
| | | #if defined(__GNUC__) && ! defined (__declspec) |
| | | # error Please upgrade your GNU compiler to one that supports __declspec. |
| | | #endif |
| | | |
| | | /* |
| | | * When building the library, you should define PTW32_BUILD so that |
| | | * the variables/functions are exported correctly. When using the library, |
| | | * do NOT define PTW32_BUILD, and then the variables/functions will |
| | | * be imported correctly. |
| | | */ |
| | | #if !defined(PTW32_STATIC_LIB) |
| | | # if defined(PTW32_BUILD) |
| | | # define PTW32_DLLPORT __declspec (dllexport) |
| | | # else |
| | | # define PTW32_DLLPORT __declspec (dllimport) |
| | | # endif |
| | | #else |
| | | # define PTW32_DLLPORT |
| | | #endif |
| | | |
| | | /* |
| | | * This is a duplicate of what is in the autoconf config.h, |
| | | * which is only used when building the pthread-win32 libraries. |
| | | */ |
| | | |
| | | #if !defined(PTW32_CONFIG_H) |
| | | # if defined(WINCE) |
| | | # define NEED_ERRNO |
| | | # define NEED_SEM |
| | | # endif |
| | | # if defined(__MINGW64__) |
| | | # define HAVE_STRUCT_TIMESPEC |
| | | # define HAVE_MODE_T |
| | | # elif defined(_UWIN) || defined(__MINGW32__) |
| | | # define HAVE_MODE_T |
| | | # endif |
| | | #endif |
| | | |
| | | /* |
| | | * |
| | | */ |
| | | |
| | | #if PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX |
| | | #if defined(NEED_ERRNO) |
| | | #include "need_errno.h" |
| | | #else |
| | | #include <errno.h> |
| | | #endif |
| | | #endif /* PTW32_SEMAPHORE_LEVEL >= PTW32_SEMAPHORE_LEVEL_MAX */ |
| | | |
| | | #define _POSIX_SEMAPHORES |
| | | |
| | | #if defined(__cplusplus) |
| | | extern "C" |
| | | { |
| | | #endif /* __cplusplus */ |
| | | |
| | | #if !defined(HAVE_MODE_T) |
| | | typedef unsigned int mode_t; |
| | | #endif |
| | | |
| | | |
| | | typedef struct sem_t_ * sem_t; |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_init (sem_t * sem, |
| | | int pshared, |
| | | unsigned int value); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem, |
| | | const struct timespec * abstime); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_post (sem_t * sem); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem, |
| | | int count); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_open (const char * name, |
| | | int oflag, |
| | | mode_t mode, |
| | | unsigned int value); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_close (sem_t * sem); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_unlink (const char * name); |
| | | |
| | | PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem, |
| | | int * sval); |
| | | |
| | | #if defined(__cplusplus) |
| | | } /* End of extern "C" */ |
| | | #endif /* __cplusplus */ |
| | | |
| | | #undef PTW32_SEMAPHORE_LEVEL |
| | | #undef PTW32_SEMAPHORE_LEVEL_MAX |
| | | |
| | | #endif /* !SEMAPHORE_H */ |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework"> |
| | | <Rule Name="ReferencedPackagesca8d1376-8d5b-4588-818b-9493d2f51973" PageTemplate="tool" DisplayName="Referenced Packages" SwitchPrefix="/" Order="1"> |
| | | <Rule.Categories> |
| | | <Category Name="pthreads" DisplayName="pthreads" /> |
| | | </Rule.Categories> |
| | | <Rule.DataSource> |
| | | <DataSource Persistence="ProjectFile" ItemType="" /> |
| | | </Rule.DataSource> |
| | | <EnumProperty Name="Linkage-pthreads" DisplayName="Linkage" Description="Which version of the .lib file to link to this library" Category="pthreads"> |
| | | <EnumValue Name="" DisplayName="Dynamic Library (DLL)" /> |
| | | <EnumValue Name="static" DisplayName="Static" /> |
| | | <EnumValue Name="ltcg" DisplayName="Link Time Compiler Generation" /> |
| | | </EnumProperty> |
| | | <EnumProperty Name="CallingConvention-pthreads" DisplayName="CallingConvention" Description="Calling convention model to use (for x86 only)" Category="pthreads"> |
| | | <EnumValue Name="" DisplayName="cdecl" /> |
| | | <EnumValue Name="stdcall" DisplayName="stdcall (Uncommon)" /> |
| | | </EnumProperty> |
| | | </Rule> |
| | | </ProjectSchemaDefinitions> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="pthreads_init"> |
| | | <PropertyGroup Label="Debug and static and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And ('$(RuntimeLibrary)' == '')"> |
| | | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
| | | </PropertyGroup> |
| | | <PropertyGroup Label="Release and static and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And ('$(RuntimeLibrary)' == '')"> |
| | | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
| | | </PropertyGroup> |
| | | <PropertyGroup Label="Debug and ltcg and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'ltcg' And ('$(RuntimeLibrary)' == '')"> |
| | | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
| | | </PropertyGroup> |
| | | <PropertyGroup Label="Release and ltcg and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'ltcg' And ('$(RuntimeLibrary)' == '')"> |
| | | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
| | | </PropertyGroup> |
| | | <PropertyGroup Label="Default initializers for properties"> |
| | | <Linkage-pthreads Condition="'$(Linkage-pthreads)' == ''">dynamic</Linkage-pthreads> |
| | | <CallingConvention-pthreads Condition="'$(CallingConvention-pthreads)' == ''">cdecl</CallingConvention-pthreads> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | | <PropertyPageSchema Include="$(MSBuildThisFileDirectory)\default-propertiesui.xml" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <PropertyPageSchema Include="$(MSBuildThisFileDirectory)\pthreads-propertiesui-066c15f0-790b-4ca8-80a9-e161cb68bc9c.xml" /> |
| | | </ItemGroup> |
| | | <ItemDefinitionGroup> |
| | | <ClCompile> |
| | | <PreprocessorDefinitions>HAS_PTHREAD;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)../..//build/native/include/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
| | | </ClCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="static" Condition="'$(Linkage-pthreads.ToLower())' == 'static'"> |
| | | <ClCompile> |
| | | <PreprocessorDefinitions>PTW32_STATIC_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| | | <RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary> |
| | | </ClCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="ltcg" Condition="'$(Linkage-pthreads.ToLower())' == 'ltcg'"> |
| | | <ClCompile> |
| | | <RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary> |
| | | </ClCompile> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Release\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Release\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Release\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Release\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Debug\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Debug\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Debug\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Debug\dynamic\cdecl\libpthread.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Release\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Release\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Release\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Release\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Debug\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Debug\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Debug\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Debug\dynamic\stdcall\libpthread-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Release and static and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Release\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Release and static and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Release\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Release and static and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Release\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Release and static and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Release\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Debug and static and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Debug\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Debug and static and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Debug\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Debug and static and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Debug\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Debug and static and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'cdecl'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Debug\static\cdecl\libpthread-static.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Release and static and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Release\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Release and static and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Release\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Release and static and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Release\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Release and static and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Release\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and Win32 and Debug and static and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\Win32\Debug\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and Win32 and Debug and static and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\Win32\Debug\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v100 and x64 and Debug and static and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v100\x64\Debug\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <ItemDefinitionGroup Label="v110 and x64 and Debug and static and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads.ToLower())' == 'static' And '$(CallingConvention-pthreads.ToLower())' == 'stdcall'"> |
| | | <Link> |
| | | <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/v110\x64\Debug\static\stdcall\libpthread-static-stdcall.lib;%(AdditionalDependencies)</AdditionalDependencies> |
| | | </Link> |
| | | </ItemDefinitionGroup> |
| | | <UsingTask TaskName="pthreads_Contains" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" TaskFactory="CodeTaskFactory"> |
| | | <ParameterGroup> |
| | | <Text Output="false" ParameterType="System.String" /> |
| | | <Library Output="false" Required="true" ParameterType="System.String" /> |
| | | <Value Output="false" Required="true" ParameterType="System.String" /> |
| | | <Result Output="true" ParameterType="System.String" /> |
| | | </ParameterGroup> |
| | | <Task> |
| | | <Code>Result = ((Text ?? "").Split(';').Contains(Library) ) ? Value : String.Empty;</Code> |
| | | </Task> |
| | | </UsingTask> |
| | | <Target Name="pthreads_init"> |
| | | <pthreads_Contains Text="Linkage-dynamic" Library="pthreads" Value="dynamic" Condition="'$(Linkage-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="Linkage-static" Library="pthreads" Value="static" Condition="'$(Linkage-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="Linkage-ltcg" Library="pthreads" Value="ltcg" Condition="'$(Linkage-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="Linkage-sxs" Library="pthreads" Value="sxs" Condition="'$(Linkage-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="CallingConvention-cdecl" Library="pthreads" Value="cdecl" Condition="'$(CallingConvention-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="CallingConvention-stdcall" Library="pthreads" Value="stdcall" Condition="'$(CallingConvention-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="CallingConvention-fastcall" Library="pthreads" Value="fastcall" Condition="'$(CallingConvention-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="CallingConvention-thiscall" Library="pthreads" Value="thiscall" Condition="'$(CallingConvention-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads" /> |
| | | </pthreads_Contains> |
| | | <pthreads_Contains Text="CallingConvention-clrcall" Library="pthreads" Value="clrcall" Condition="'$(CallingConvention-pthreads)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads" /> |
| | | </pthreads_Contains> |
| | | </Target> |
| | | </Project> |
New file |
| | |
| | | configurations { |
| | | Toolset { |
| | | key : "PlatformToolset"; |
| | | choices : { v110, v100 }; |
| | | }; |
| | | Platform { |
| | | key : "Platform"; |
| | | choices : { Win32, x64 }; |
| | | Win32.aliases : { x86, win32, ia32, 386 }; |
| | | x64.aliases : { x64, amd64, em64t, intel64, x86-64, x86_64 }; |
| | | }; |
| | | Configuration { |
| | | key : "Configuration"; |
| | | choices : { Release, Debug }; |
| | | }; |
| | | Linkage { |
| | | choices : { dynamic, static, ltcg }; |
| | | }; |
| | | CallingConvention { |
| | | choices : { cdecl, stdcall }; |
| | | }; |
| | | Other { |
| | | key : "OTHER_STUFF"; |
| | | choices : { RuntimeLibraryNull }; |
| | | }; |
| | | }; |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework"> |
| | | <Rule Name="ProjectSettings_globals" PageTemplate="tool" DisplayName="Project Master Settings" SwitchPrefix="/" Order="1"> |
| | | <Rule.Categories> |
| | | <Category Name="cpp" DisplayName="C/C++ Settings" /> |
| | | </Rule.Categories> |
| | | <Rule.DataSource> |
| | | <DataSource Persistence="ProjectFile" ItemType="" /> |
| | | </Rule.DataSource> |
| | | <EnumProperty Name="RuntimeLibrary" DisplayName="Runtime Library" Description="Specify runtime library for linking." Category="cpp" > |
| | | <EnumValue Name="MultiThreaded" DisplayName="Multi-threaded" Description="Causes your application to use the multithread, static version of the run-time library."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDebug" DisplayName="Multi-threaded Debug" Description="Defines _DEBUG and _MT. This option also causes the compiler to place the library name LIBCMTD.lib into the .obj file so that the linker will use LIBCMTD.lib to resolve external symbols."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDLL" DisplayName="Multi-threaded DLL" Description="Causes your application to use the multithread- and DLL-specific version of the run-time library. Defines _MT and _DLL and causes the compiler to place the library name MSVCRT.lib into the .obj file."> |
| | | </EnumValue> |
| | | <EnumValue Name="MultiThreadedDebugDLL" DisplayName="Multi-threaded Debug DLL" Description="Defines _DEBUG, _MT, and _DLL and causes your application to use the debug multithread- and DLL-specific version of the run-time library. It also causes the compiler to place the library name MSVCRTD.lib into the .obj file."> |
| | | </EnumValue> |
| | | </EnumProperty> |
| | | </Rule> |
| | | </ProjectSchemaDefinitions> |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" InitialTargets="pthreads_redist_init;pthreads_redist_init_2"> |
| | | <PropertyGroup Label="Default initializers for properties"> |
| | | <Linkage-pthreads_redist Condition="'$(Linkage-pthreads_redist)' == ''">dynamic</Linkage-pthreads_redist> |
| | | <CallingConvention-pthreads_redist Condition="'$(CallingConvention-pthreads_redist)' == ''">cdecl</CallingConvention-pthreads_redist> |
| | | </PropertyGroup> |
| | | <Target Name="pthreads_redist_init"> |
| | | <pthreads_redist_Contains Text="Linkage-dynamic" Library="pthreads_redist" Value="dynamic" Condition="'$(Linkage-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="Linkage-static" Library="pthreads_redist" Value="static" Condition="'$(Linkage-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="Linkage-ltcg" Library="pthreads_redist" Value="ltcg" Condition="'$(Linkage-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="Linkage-sxs" Library="pthreads_redist" Value="sxs" Condition="'$(Linkage-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="Linkage-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="CallingConvention-cdecl" Library="pthreads_redist" Value="cdecl" Condition="'$(CallingConvention-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="CallingConvention-stdcall" Library="pthreads_redist" Value="stdcall" Condition="'$(CallingConvention-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="CallingConvention-fastcall" Library="pthreads_redist" Value="fastcall" Condition="'$(CallingConvention-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="CallingConvention-thiscall" Library="pthreads_redist" Value="thiscall" Condition="'$(CallingConvention-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | <pthreads_redist_Contains Text="CallingConvention-clrcall" Library="pthreads_redist" Value="clrcall" Condition="'$(CallingConvention-pthreads_redist)'==''"> |
| | | <Output TaskParameter="Result" PropertyName="CallingConvention-pthreads_redist" /> |
| | | </pthreads_redist_Contains> |
| | | </Target> |
| | | <Target Name="pthreads_redist_init_2"> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\cdecl"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | <SetEnv Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" Name="PATH" Prefix="true" Value="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\stdcall"> |
| | | <Output TaskParameter="OutputEnvironmentVariable" PropertyName="PATH" /> |
| | | </SetEnv> |
| | | </Target> |
| | | <ItemGroup Label="v100 and Win32 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and Win32 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and x64 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and x64 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and Win32 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and Win32 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and x64 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and x64 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\cdecl\libpthread.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and Win32 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and Win32 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and x64 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and x64 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and Win32 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and Win32 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v100 and x64 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup Label="v110 and x64 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'"> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | <None Include="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" Condition="(('$(AppContainerApplication.ToLower())' == 'true')) OR (('$(TargetPlatformIdentifier.ToLower())' == 'windows phone' And '$(TargetPlatformVersion)' == '8.0'))"> |
| | | <DeploymentContent>true</DeploymentContent> |
| | | </None> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <PropertyPageSchema Include="$(MSBuildThisFileDirectory)\default-propertiesui.xml" /> |
| | | </ItemGroup> |
| | | <Target Name="pthreads_redist_AfterBuild" AfterTargets="AfterBuild" /> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_Win32_and_Release_and_dynamic_and_cdecl" Label="v100 and Win32 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_Win32_and_Release_and_dynamic_and_cdecl" Label="v110 and Win32 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_x64_and_Release_and_dynamic_and_cdecl" Label="v100 and x64 and Release and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_x64_and_Release_and_dynamic_and_cdecl" Label="v110 and x64 and Release and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_Win32_and_Debug_and_dynamic_and_cdecl" Label="v100 and Win32 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_Win32_and_Debug_and_dynamic_and_cdecl" Label="v110 and Win32 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_x64_and_Debug_and_dynamic_and_cdecl" Label="v100 and x64 and Debug and dynamic and cdecl" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_x64_and_Debug_and_dynamic_and_cdecl" Label="v110 and x64 and Debug and dynamic and cdecl" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'cdecl'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\cdecl\libpthread.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_Win32_and_Release_and_dynamic_and_stdcall" Label="v100 and Win32 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_Win32_and_Release_and_dynamic_and_stdcall" Label="v110 and Win32 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_x64_and_Release_and_dynamic_and_stdcall" Label="v100 and x64 and Release and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_x64_and_Release_and_dynamic_and_stdcall" Label="v110 and x64 and Release and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Release\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_Win32_and_Debug_and_dynamic_and_stdcall" Label="v100 and Win32 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_Win32_and_Debug_and_dynamic_and_stdcall" Label="v110 and Win32 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'win32' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\Win32\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v100_and_x64_and_Debug_and_dynamic_and_stdcall" Label="v100 and x64 and Debug and dynamic and stdcall" Condition="'$(PlatformToolset.ToLower())' == 'v100' And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v100\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <Target Name="pthreads_redist_AfterBuild_v110_and_x64_and_Debug_and_dynamic_and_stdcall" Label="v110 and x64 and Debug and dynamic and stdcall" Condition="( $(PlatformToolset.ToLower().IndexOf('v110')) > -1 Or '$(PlatformToolset.ToLower())' == 'windowskernelmodedriver8.0' Or '$(PlatformToolset.ToLower())' == 'windowsapplicationfordrivers8.0' Or '$(PlatformToolset.ToLower())' == 'windowsusermodedriver8.0' ) And '$(Platform.ToLower())' == 'x64' And ( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-pthreads_redist.ToLower())' == 'dynamic' And '$(CallingConvention-pthreads_redist.ToLower())' == 'stdcall'" AfterTargets="pthreads_redist_AfterBuild"> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | <Copy SourceFiles="$(MSBuildThisFileDirectory)../..//build/native/bin/v110\x64\Debug\dynamic\stdcall\libpthread-stdcall.dll" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true" /> |
| | | </Target> |
| | | <UsingTask TaskName="pthreads_redist_Contains" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" TaskFactory="CodeTaskFactory"> |
| | | <ParameterGroup> |
| | | <Text Output="false" ParameterType="System.String" /> |
| | | <Library Output="false" Required="true" ParameterType="System.String" /> |
| | | <Value Output="false" Required="true" ParameterType="System.String" /> |
| | | <Result Output="true" ParameterType="System.String" /> |
| | | </ParameterGroup> |
| | | <Task> |
| | | <Code>Result = ((Text ?? "").Split(';').Contains(Library) ) ? Value : String.Empty;</Code> |
| | | </Task> |
| | | </UsingTask> |
| | | </Project> |