Skip to content

Commit

Permalink
mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
Keisuke Miyako committed Jun 19, 2018
1 parent 7336d1d commit d6f8edf
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 6 deletions.
12 changes: 10 additions & 2 deletions FreeXL/4DPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@
#include "4DPluginAPI.h"
#include "4DPlugin.h"

#include "freexl.h"

#pragma mark - map object references to number

typedef const void *xls_handle;
std::map<uint32_t, xls_handle> __handles;

uint32_t __handleSet(xls_handle h){

std::mutex m;
std::lock_guard<std::mutex> lock(m);

uint32_t i = 1;

while (__handles.find(i) != __handles.end()) {
Expand All @@ -33,6 +35,9 @@ uint32_t __handleSet(xls_handle h){

xls_handle __handleGet(uint32_t i){

std::mutex m;
std::lock_guard<std::mutex> lock(m);

xls_handle h = NULL;

std::map<uint32_t, xls_handle>::iterator pos = __handles.find(i);
Expand All @@ -46,6 +51,9 @@ xls_handle __handleGet(uint32_t i){

void __handleClear(uint32_t i){

std::mutex m;
std::lock_guard<std::mutex> lock(m);

xls_handle h = NULL;

std::map<uint32_t, xls_handle>::iterator pos = __handles.find(i);
Expand Down
2 changes: 2 additions & 0 deletions FreeXL/4DPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "freexl.h"

#include <mutex>

// --- FreeXL
void FreeXL_Get_worksheet_name(sLONG_PTR *pResult, PackagePtr pParams);
void FreeXL_Get_info(sLONG_PTR *pResult, PackagePtr pParams);
Expand Down
Binary file modified FreeXL/FreeXL.4dbase/Plugins/FreeXL.bundle/Contents/MacOS/FreeXL
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -419,22 +419,22 @@
<dict>
<key>hash</key>
<data>
JlzMnoAaHmeE14GrQa8ubbeDYaE=
wjlyi3hJe435qgnn/6SVraDrZH0=
</data>
<key>hash2</key>
<data>
TUDUEfbJbs38gnsG2JyMAXbGrywG7p/3A3Qc58GqEXI=
7LLPnE2UFdt0YRy1ivVSxYo5QAb2Pc4FTcKwbtm0K9o=
</data>
</dict>
<key>Windows64/FreeXL.4DX</key>
<dict>
<key>hash</key>
<data>
WD1//PU2flLNtzGwZ+jFgQU3wpQ=
kaE6Hc9YYJVqDhZO18FvNfQ4cZE=
</data>
<key>hash2</key>
<data>
PE8/xzp7VhQiG9Ewuy6qX6hPssWprM6Nsey3yqm7F2I=
c85FjMstDTrJcuzRcPgWMWuITLvxdaN//zLL8tYsEYw=
</data>
</dict>
<key>manifest.json</key>
Expand Down
Binary file not shown.

0 comments on commit d6f8edf

Please sign in to comment.