Skip to content

Commit bee6dd2

Browse files
committed
Resolved warning in BlackJackClient, switched to using std::mutex, and now using ENOINT on linux for file-not-found
1 parent cf18012 commit bee6dd2

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

Release/collateral/Samples/BlackJack/BlackJack_Client/BlackJackClient.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#endif
3636

3737
using namespace std;
38-
using namespace web;
38+
using namespace web;
3939
using namespace utility;
4040
using namespace http;
4141
using namespace http::client;
@@ -62,6 +62,7 @@ void PrintResult(BJHandResult result)
6262
case HR_PlayerWin: ucout << "Player wins"; break;
6363
case HR_ComputerWin: ucout << "Computer Wins"; break;
6464
case HR_Push:ucout << "Push"; break;
65+
default: std::abort();
6566
}
6667
}
6768

@@ -141,6 +142,8 @@ void PrintTable(const http_response &response, bool &refresh)
141142
case ST_YourTurn:
142143
ucout << "Your turn!\n";
143144
break;
145+
default:
146+
std::abort();
144147
}
145148
}
146149
}

Release/include/pplx/pplxlinux.h

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646
#include "compat/linux_compat.h"
4747
#endif
4848

49-
#include "boost/thread/mutex.hpp"
50-
#include "boost/thread/condition_variable.hpp"
51-
#include "boost/date_time/posix_time/posix_time_types.hpp"
52-
#include "boost/bind/bind.hpp"
53-
5449
#include "pplx/pplxinterface.h"
5550

5651

@@ -240,11 +235,7 @@ namespace platform
240235
}
241236

242237
private:
243-
#if defined(__APPLE__)
244-
std::mutex _M_cs;
245-
#else
246-
::boost::mutex _M_cs;
247-
#endif
238+
::std::mutex _M_cs;
248239
long _M_recursionCount;
249240
volatile long _M_owner;
250241
};
@@ -326,7 +317,7 @@ namespace extensibility
326317
{
327318
typedef ::pplx::details::event_impl event_t;
328319

329-
typedef ::boost::mutex critical_section_t;
320+
typedef ::std::mutex critical_section_t;
330321
typedef scoped_lock<critical_section_t> scoped_critical_section_t;
331322

332323
typedef ::pplx::details::reader_writer_lock_impl reader_writer_lock_t;

Release/src/streams/linux/fileio_linux.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class io_scheduler
7373
void submit_io()
7474
{
7575
m_no_outstanding_work.reset();
76-
++m_outstanding_work;
76+
++m_outstanding_work;
7777
}
7878

7979
void complete_io()
@@ -176,7 +176,7 @@ using namespace Concurrency::streams::details;
176176
/// <returns>The error code if there was an error in file creation.</returns>
177177
bool _finish_create(int fh, _filestream_callback *callback, std::ios_base::openmode mode, int /* prot */)
178178
{
179-
if ( fh != -1 )
179+
if ( fh != -1 )
180180
{
181181
std::shared_ptr<io_scheduler> sched = get_scheduler();
182182

@@ -185,7 +185,7 @@ bool _finish_create(int fh, _filestream_callback *callback, std::ios_base::openm
185185
// letting the OS do its buffering, even if it means that prompt reads won't
186186
// happen.
187187
bool buffer = (mode == std::ios_base::in);
188-
188+
189189
// seek to end if requested
190190
if (mode & std::ios_base::ate)
191191
{
@@ -204,11 +204,8 @@ bool _finish_create(int fh, _filestream_callback *callback, std::ios_base::openm
204204
}
205205
else
206206
{
207-
#ifdef __APPLE__
208-
auto exptr = std::make_exception_ptr(std::ios_base::failure("failed to create file", std::make_error_code(std::errc::no_such_file_or_directory)));
209-
#else
210-
auto exptr = std::make_exception_ptr(std::ios_base::failure("failed to create file"));
211-
#endif
207+
auto enoint = std::make_error_code(std::errc::no_such_file_or_directory);
208+
auto exptr = std::make_exception_ptr(std::ios_base::failure("failed to create file", enoint));
212209
callback->on_error(exptr);
213210
return false;
214211
}

0 commit comments

Comments
 (0)