File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ typedef struct DtmTransStatus
54
54
typedef struct
55
55
{
56
56
cid_t cid ;
57
+ long time_shift ;
57
58
volatile slock_t lock ;
58
59
DtmTransStatus * trans_list_head ;
59
60
DtmTransStatus * * trans_list_tail ;
@@ -105,7 +106,7 @@ static timestamp_t dtm_get_current_time()
105
106
{
106
107
struct timeval tv ;
107
108
gettimeofday (& tv , NULL );
108
- return (timestamp_t )tv .tv_sec * USEC + tv .tv_usec ;
109
+ return (timestamp_t )tv .tv_sec * USEC + tv .tv_usec + local -> time_shift ;
109
110
}
110
111
111
112
static void dtm_sleep (timestamp_t interval )
@@ -136,6 +137,11 @@ static cid_t dtm_get_cid()
136
137
static cid_t dtm_sync (cid_t global_cid )
137
138
{
138
139
cid_t local_cid ;
140
+ #if 1
141
+ while ((local_cid = dtm_get_cid ()) < global_cid ) {
142
+ local -> time_shift += global_cid - local_cid ;
143
+ }
144
+ #else
139
145
while ((local_cid = dtm_get_cid ()) < global_cid ) {
140
146
SpinLockRelease (& local -> lock );
141
147
#if TRACE_SLEEP_TIME
@@ -160,6 +166,7 @@ static cid_t dtm_sync(cid_t global_cid)
160
166
#endif
161
167
SpinLockAcquire (& local -> lock );
162
168
}
169
+ #endif
163
170
return global_cid ;
164
171
}
165
172
@@ -525,6 +532,7 @@ void DtmInitialize()
525
532
local = (DtmNodeState * )ShmemInitStruct ("dtm" , sizeof (DtmNodeState ), & found );
526
533
if (!found )
527
534
{
535
+ local -> time_shift = 0 ;
528
536
local -> cid = dtm_get_current_time ();
529
537
local -> trans_list_head = NULL ;
530
538
local -> trans_list_tail = & local -> trans_list_head ;
You can’t perform that action at this time.
0 commit comments